---
title: Response
summary: Response to an outgoing HTTP request made by this server.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/struct.Response/
---

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

```go
type Response struct {
	Request *Request

	Backend string

	StatusCode int

	Header Header

	Body io.ReadCloser
	// contains filtered or unexported fields
}
```

Response to an outgoing HTTP request made by this server.

## Fields

### Request

**Type:** `*Request`

Request associated with the response.

### Backend

**Type:** `string`

Backend that served the response.

### StatusCode

**Type:** `int`

StatusCode of the response.

### Header

**Type:** `Header`

Header received with the response.

### Body

**Type:** `io.ReadCloser`

Body of the response.

## Methods

### Age

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L233

```go
func (resp *Response) Age() (uint32, bool)
```

Age returns current age in seconds of the cached item, relative to the originating backend.

**Returns**

`(uint32, bool)`

### Close

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L51

```go
func (resp *Response) Close() error
```

Close releases the response resources if the response will be discarded without being used.

**Returns**

`error`

### Cookies

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L59

```go
func (resp *Response) Cookies() []*Cookie
```

Cookies parses and returns the cookies set in the Set-Cookie headers.

**Returns**

`[]*Cookie`

### FromCache

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L212

```go
func (resp *Response) FromCache() bool
```

FromCache returns whether the response was returned from the cache (true) or fresh from the backend (false).

**Returns**

`bool`

### MaskedError

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L121

```go
func (r *Response) MaskedError() error
```

If this response was served from the cache *and* the response was stale-if-error,
this is the error from the revalidation attempt.

**Returns**

`error`

### RemoteAddr

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L64

```go
func (resp *Response) RemoteAddr() (net.Addr, error)
```

RemoteAddr returns the address of the server that provided the response.

**Returns**

`(net.Addr, error)`

### StaleIfError

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L251

```go
func (resp *Response) StaleIfError() (uint32, bool)
```

StaleIfError returns the time in seconds for which a cached item delivered stale if synchronous revalidation produces an error.

**Returns**

`(uint32, bool)`

### StaleWhileRevalidate

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L242

```go
func (resp *Response) StaleWhileRevalidate() (uint32, bool)
```

StaleWhileRevalidate returns the time in seconds for which a cached item can safely be used despite being considered stale.

**Returns**

`(uint32, bool)`

### SurrogateKeys

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L265

```go
func (resp *Response) SurrogateKeys() string
```

SurrogateKeys returns the surrogate keys for the cached response.

**Returns**

`string`

### Trailers

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L84

```go
func (resp *Response) Trailers() (Header, error)
```

Trailers returns the trailers associated with the response.  Can only be called after the response Body returns EOF.

**Returns**

`(Header, error)`

### TTL

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L224

```go
func (resp *Response) TTL() (uint32, bool)
```

TTL returns the Time to Live (TTL) in seconds in the cache for this response.

The TTL determines the duration of "freshness" for the cached response
after it is inserted into the cache.

**Returns**

`(uint32, bool)`

### Vary

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/response.go#L260

```go
func (resp *Response) Vary() string
```

Vary returns the set of request headers for which the response may vary.

**Returns**

`string`
