Response

Structin fsthttpcompute-sdk-go v1.11.0View source
1
2
3
4
5
6
7
8
9
10
11
12
type Response struct {
Backend string
StatusCode int
// contains filtered or unexported fields
}

Response to an outgoing HTTP request made by this server.

Fields

Request

*Request

Request associated with the response.

Backend

string

Backend that served the response.

StatusCode

int

StatusCode of the response.

Header

Header

Header received with the response.

Body of the response.

Methods

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

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

Returns

(uint32, bool)
func (resp *Response) Close() error

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

Returns

error
func (resp *Response) Cookies() []*Cookie

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

Returns

FromCache

View source
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

View source
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

View source
func (resp *Response) RemoteAddr() (net.Addr, error)

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

Returns

(net.Addr, error)

StaleIfError

View source
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

View source
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

View source
func (resp *Response) SurrogateKeys() string

SurrogateKeys returns the surrogate keys for the cached response.

Returns

string

Trailers

View source
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)
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)
func (resp *Response) Vary() string

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

Returns

string