Wasm Directoryalpha
Resource

outgoing-response

Represents an outgoing HTTP Response.

resource outgoing-response;

F constructor

constructor: func(headers: headers) -> outgoing-response;

Construct an outgoing-response, with a default status-code of 200. If a different status-code is needed, it must be set via the set-status-code method.

  • headers is the HTTP Headers for the Response.

F status-code

status-code: func() -> status-code;

Get the HTTP Status Code for the Response.

F set-status-code

set-status-code: func(status-code: status-code) -> result​<_, _>;

Set the HTTP Status Code for the Response. Fails if the status-code given is not a valid http status code.

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.

This headers resource is a child: it must be dropped before the parent outgoing-request is dropped, or its ownership is transferred to another component by e.g. outgoing-handler.handle.

F body

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

Returns the resource corresponding to the outgoing Body for this Response.

Returns success on the first call: the outgoing-body resource for this outgoing-response can be retrieved at most once. Subsequent calls will return error.