Skip to main content

Response Variables

The following variables are available under the res namespace:
NameTypeDescription
res.content_encodinglist[string]The encoding set in the Content-Encoding header for this response.
res.content_lengthint64The length of the content associated with the response.
res.content_typestringThe media type set in the Content-Type header for this response.
res.content_type.parametersmap[string]stringThe parameters set in the Content-Type header for this response.
res.content_type.rawstringThe Content-Type header for this response as a string.
res.cookiesmap[string][]cookieThe HTTP cookie objects included in this response. If there are multiple cookies with the same name, they will be ordered by path length, with longest path first.
res.cookies[k][i].domainstringThe value of the Domain attribute of the cookie.
res.cookies[k][i].expirestimestampThe value of the Expires attribute of the cookie.
res.cookies[k][i].http_onlybooleanThe value of the HttpOnly attribute of the cookie.
res.cookies[k][i].max_agedurationThe value of the MaxAge attribute of the cookie.
res.cookies[k][i].namestringThe name of the cookie.
res.cookies[k][i].pathstringThe value of the Path attribute of the cookie.
res.cookies[k][i].same_sitestringThe value of the SameSite attribute of the cookie.
res.cookies[k][i].securebooleanThe value of the Secure attribute of the cookie.
res.cookies[k][i].unparsed_attributesmap[string]stringAny non-standard attributes of the cookie parsed as a map of names to values .
res.cookies[k][i].valuestringThe value of the cookie.
res.headersmap[string][]stringThe response headers parsed as a map of lower-case names to values.
res.locationstringThe Location header value of this response.
res.status_codeint32The status code of this response.
res.trailersmap[string][]stringThe response trailers parsed as a map of lower-case names to values.

res.content_encoding

The encoding set in the Content-Encoding header for this response.

res.content_length

The length of the content associated with the response.

res.content_type

The media type set in the Content-Type header for this response.

res.content_type.parameters

The parameters set in the Content-Type header for this response.

res.content_type.raw

The Content-Type header for this response as a string.

res.cookies

The HTTP cookie objects included in this response. If there are multiple cookies with the same name, they will be ordered by path length, with longest path first.

res.cookies[k][i].domain

The value of the Domain attribute of the cookie.

res.cookies[k][i].expires

The value of the Expires attribute of the cookie.

res.cookies[k][i].http_only

The value of the HttpOnly attribute of the cookie.

res.cookies[k][i].max_age

The value of the MaxAge attribute of the cookie.

res.cookies[k][i].name

The name of the cookie.

res.cookies[k][i].path

The value of the Path attribute of the cookie.

res.cookies[k][i].same_site

The value of the SameSite attribute of the cookie.

res.cookies[k][i].secure

The value of the Secure attribute of the cookie.

res.cookies[k][i].unparsed_attributes

Any non-standard attributes of the cookie parsed as a map of names to values.

res.cookies[k][i].value

The value of the cookie.

res.headers

The response headers parsed as a map of lower-case names to values.

res.location

The location header value of the response.

res.status_code

The status code of this response.

res.trailers

The response trailers parsed as a map of lower-case names to values.