Response
123456789101112type Response struct {
Backend string
StatusCode int
Body io.ReadCloser // contains filtered or unexported fields}Response to an outgoing HTTP request made by this server.
Fields
Request
*RequestRequest associated with the response.
Header
HeaderHeader received with the response.
Body
io.ReadCloserBody of the response.
Methods
Age
View sourcefunc (resp *Response) Age() (uint32, bool)Age returns current age in seconds of the cached item, relative to the originating backend.
Returns
Close
View sourcefunc (resp *Response) Close() errorClose releases the response resources if the response will be discarded without being used.
Returns
Cookies
View sourceCookies parses and returns the cookies set in the Set-Cookie headers.
Returns
FromCache
View sourcefunc (resp *Response) FromCache() boolFromCache returns whether the response was returned from the cache (true) or fresh from the backend (false).
Returns
MaskedError
View sourcefunc (r *Response) MaskedError() errorIf this response was served from the cache and the response was stale-if-error, this is the error from the revalidation attempt.
Returns
RemoteAddr
View sourceRemoteAddr returns the address of the server that provided the response.
Returns
StaleIfError
View sourcefunc (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
StaleWhileRevalidate
View sourcefunc (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
SurrogateKeys
View sourcefunc (resp *Response) SurrogateKeys() stringSurrogateKeys returns the surrogate keys for the cached response.
Returns
Trailers
View sourceTrailers returns the trailers associated with the response. Can only be called after the response Body returns EOF.
Returns
TTL
View sourcefunc (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
Vary
View sourcefunc (resp *Response) Vary() stringVary returns the set of request headers for which the response may vary.
Returns