← index

[HTTP]ServerRequest

inherits Object · defined at net/http_server.qn:41

An inbound request: the parsed head plus the body as an [HTTP]Body — stream-backed while undrained, empty bytes-backed when the request has none, so handlers never nil-check. target is the raw request-target as sent (undecoded — percent decoding is the [Web] layer's job); version is the HTTP/1.x minor (0 | 1). (@params is an inert slot here: the [Web] router binds route params into it through the reopened params:/param: conveniences.)

extended at web/04-app.qn:24

The [Web] layer's request conveniences, layered onto the transport request by reopening — extension by <-- is the Quoin way to layer without wrappers.

Instance methods

body

The body as an [HTTP]Body — stream-backed until read; a request without one answers an empty body, never nil.

net/http_server.qn:65

form

The body parsed as application/x-www-form-urlencoded ('+' means space).

web/04-app.qn:50

header:

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

net/http_server.qn:62

headers

Headers as a #(name value) pair list, order- and duplicate-preserving.

net/http_server.qn:60

init:

Internal: normalize the head fields — nil headers become #(), a nil body an empty bytes-backed one.

net/http_server.qn:44

json

The body parsed as JSON; bad input throws a catchable ParseError.

web/04-app.qn:48

mediaType

The body's lowercased media type ('application/json'), or nil.

web/04-app.qn:52

method

The request verb as sent (e.g. 'GET').

net/http_server.qn:53

param:

One route binding by name ('/users/:id' -> req.param:'id'), or nil.

web/04-app.qn:30

params

Route bindings as a Map (set by the app's router before the handler runs).

web/04-app.qn:26

params:

Internal: bind the route params (the router calls this before the handler).

web/04-app.qn:28

path

The request path: the raw target with any query string stripped. Segments stay percent-encoded — the router decodes per segment, so an encoded %2F can't split the path; params/query values arrive decoded.

web/04-app.qn:35

query

The query string as a decoded Map ('+' stays literal), parsed on demand.

web/04-app.qn:40

query:

One decoded query value by name, or nil.

web/04-app.qn:45

rawTarget

The raw request-target exactly as sent, query string included, undecoded.

web/04-app.qn:37

s

Human rendering: verb and target.

net/http_server.qn:68

target

The raw request-target as sent, query included, still percent-encoded (decoding is the [Web] layer's job — see path / query / params there).

net/http_server.qn:56

version

The HTTP/1.x minor version: 0 or 1.

net/http_server.qn:58