Wasm Directoryalpha
Resource

outgoing-request

Represents an outgoing HTTP Request.

resource outgoing-request;

F constructor

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

Construct a new outgoing-request with a default method of GET, and none values for path-with-query, scheme, and authority.

  • headers is the HTTP Headers for the Request.

It is possible to construct, or manipulate with the accessor functions below, an outgoing-request with an invalid combination of scheme and authority, or headers which are not permitted to be sent. It is the obligation of the outgoing-handler.handle implementation to reject invalid constructions of outgoing-request.

F body

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

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

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

F method

method: func() -> method;

Get the Method for the Request.

F set-method

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

Set the Method for the Request. Fails if the string present in a method.other argument is not a syntactically valid method.

F path-with-query

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

Get the combination of the HTTP Path and Query for the Request. When none, this represents an empty Path and empty Query.

F set-path-with-query

set-path-with-query: func(path-with-query: option​<string>) -> result​<_, _>;

Set the combination of the HTTP Path and Query for the Request. When none, this represents an empty Path and empty Query. Fails is the string given is not a syntactically valid path and query uri component.

F scheme

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

Get the HTTP Related Scheme for the Request. When none, the implementation may choose an appropriate default scheme.

F set-scheme

set-scheme: func(scheme: option​<scheme>) -> result​<_, _>;

Set the HTTP Related Scheme for the Request. When none, the implementation may choose an appropriate default scheme. Fails if the string given is not a syntactically valid uri scheme.

F authority

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

Get the authority of the Request's target URI. A value of none may be used with Related Schemes which do not require an authority. The HTTP and HTTPS schemes always require an authority.

F set-authority

set-authority: func(authority: option​<string>) -> result​<_, _>;

Set the authority of the Request's target URI. A value of none may be used with Related Schemes which do not require an authority. The HTTP and HTTPS schemes always require an authority. Fails if the string given is not a syntactically valid URI authority.

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.