Wasm Directoryalpha
Resource

incoming-request

Represents an incoming HTTP Request.

resource incoming-request;

F method

method: func() -> method;

Returns the method of the incoming request.

F path-with-query

path-with-query: func() -> option​<string>;

Returns the path with query parameters from the request, as a string.

F scheme

scheme: func() -> option​<scheme>;

Returns the protocol scheme from the request.

F authority

authority: func() -> option​<string>;

Returns the authority of the Request's target URI, if present.

F headers

headers: func() -> headers;

Get the headers associated with the request.

The returned headers resource is immutable: set, append, and delete operations will fail with header-error.immutable.

The headers returned are a child resource: it must be dropped before the parent incoming-request is dropped. Dropping this incoming-request before all children are dropped will trap.

F consume

consume: func() -> result​<incoming-body, _>;

Gives the incoming-body associated with this request. Will only return success at most once, and subsequent calls will return error.