---
title: ResponseRecorder
summary: ResponseRecorder is an implementation of fsthttp.ResponseWriter that records its mutations for later inspection in tests.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsttest/struct.ResponseRecorder/
---

**Kind:** Struct  
**Module:** [fsttest](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsttest/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsttest/recorder.go#L14

```go
type ResponseRecorder struct {
	Code      int
	HeaderMap fsthttp.Header
	Body      *bytes.Buffer
	// contains filtered or unexported fields
}
```

ResponseRecorder is an implementation of fsthttp.ResponseWriter that
records its mutations for later inspection in tests.

## Fields

### Code

**Type:** `int`

### HeaderMap

**Type:** `fsthttp.Header`

### Body

**Type:** `*bytes.Buffer`

## Methods

### Append

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsttest/recorder.go#L65

```go
func (r *ResponseRecorder) Append(other io.ReadCloser) error
```

Append records the response body.  The data is written to the Body
field of the ResponseRecorder.

**Parameters**

- `other`: `io.ReadCloser`

**Returns**

`error`

### Close

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsttest/recorder.go#L55

```go
func (r *ResponseRecorder) Close() error
```

Close is a no-op on ResponseRecorder.  It exists to satisfy the
fsthttp.ResponseWriter interface.

**Returns**

`error`

### Header

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsttest/recorder.go#L31

```go
func (r *ResponseRecorder) Header() fsthttp.Header
```

Header returns the response headers to mutate within a handler.

**Returns**

`fsthttp.Header`

### SetManualFramingMode

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsttest/recorder.go#L61

```go
func (r *ResponseRecorder) SetManualFramingMode(v bool)
```

SetManualFramingMode is a no-op on ResponseRecorder.  It exists to
satisfy the fsthttp.ResponseWriter interface.

**Parameters**

- `v`: `bool`

### Write

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsttest/recorder.go#L49

```go
func (r *ResponseRecorder) Write(b []byte) (int, error)
```

Write records the response body.  The data is written to the Body
field of the ResponseRecorder.

**Parameters**

- `b`: `[]byte`

**Returns**

`(int, error)`

### WriteHeader

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsttest/recorder.go#L40

```go
func (r *ResponseRecorder) WriteHeader(code int)
```

WriteHeader records the response code.

**Parameters**

- `code`: `int`
