← index

[HTTP]Response

inherits Object · defined at net/http.qn:265

An HTTP response: status line, headers (a list of #(name value) pairs, order- and duplicate-preserving), and the body as an [HTTP]Body.

Class methods

decodeBody: encoding:

Decode a body per its Content-Encoding: gzip / x-gzip, deflate, or zstd. Identity or an unrecognized coding returns the bytes unchanged. Picks the first recognized coding mentioned (a comma-list of codings is rare).

net/http.qn:287

find: named:

Case-insensitive lookup of the first header named name in a #(name value) pair list, or nil. Shared by send (Content-Length/Transfer-Encoding) and the header: accessor.

net/http.qn:278

Instance methods

body

The body as an [HTTP]Body — stream-backed until drained (.text / .json / .bytes).

net/http.qn:311

header:

Case-insensitive lookup: the first header named name, or nil.

net/http.qn:305

headers

All headers as a #(name value) pair list, in wire order, duplicates preserved.

net/http.qn:303

init:

Internal: populate the four slots (internalSend builds responses).

net/http.qn:267

location

The Location header (a redirect's target), or nil.

net/http.qn:307

ok?

Whether the status is 2xx.

net/http.qn:301

reason

The reason phrase from the status line (e.g. 'OK'); display-only.

net/http.qn:299

redirect?

A redirect we could follow: a 3xx status carrying a Location header.

net/http.qn:309

status

The numeric status code (e.g. 200).

net/http.qn:297