request
An HTTP request.
resource request;F set-cache-override
set-cache-override: func(cache-override: cache-override) -> result<_, error>;Sets the cache override behavior for this request.
This setting will override any cache directive headers returned in response to this request.
F get-header-names
get-header-names: func(max-len: u64, cursor: u32) -> result<tuple<string, option<u32>>, error>;Reads the request's header names via a buffer of the provided size.
The first cursor names are skipped. The remaining names are encoded successively with
a NUL byte after each into a list of bytes at most max-len long. If any of the remaining
names don't fit, the returned option<u32> is the index of the first name that didn't fit,
or none if all the remaining names fit. If max-len is too small to fit any name,
an error.buffer-len error is returned, providing a recommended buffer size.
F get-header-value
get-header-value: func(name: string, max-len: u64) -> result<option<list<u8>>, error>;Gets the value of a header, or none if the header is not present.
If there are multiple values for the header, only one is returned. See
get-header-values if you need to get all of the values.
If header name requires more than max-len bytes, this will return an error.buffer-len
containing the required size.
F get-header-values
get-header-values: func(name: string, max-len: u64, cursor: u32) -> result<tuple<list<u8>, option<u32>>, error>;Gets multiple header values for the given name via a buffer of the provided size.
As opposed to get-header-value, this function returns all of the values for this header.
The first cursor values are skipped. The remaining values are encoded successively with
a NUL byte after each into a list of bytes at most max-len long. If any of the remaining
values don't fit, the returned option<u32> is the index of the first value that didn't
fit, or none if all the remaining values fit. If max-len is too small to fit any value,
an error.buffer-len error is returned, providing a recommended buffer size.
F set-header-values
set-header-values: func(name: string, values: list<u8>) -> result<_, error>;Sets the values for the given header name, replacing any headers that previously existed for that name.
F insert-header
insert-header: func(name: string, value: list<u8>) -> result<_, error>;Sets a request header to the given value, discarding any previous values for the given header name.
F append-header
append-header: func(name: string, value: list<u8>) -> result<_, error>;Adds a request header with given value.
Unlike set-header-values, this does not discard existing values for the same header name.
F remove-header
remove-header: func(name: string) -> result<_, error>;Removes all request headers of the given name
Returns ok if any headers were successfully removed.
F get-method
get-method: func(max-len: u64) -> result<string, error>;Gets the request method.
F set-method
set-method: func(method: string) -> result<_, error>;Sets the request method.
F get-uri
get-uri: func(max-len: u64) -> result<string, error>;Gets the request URI.
F set-uri
set-uri: func(uri: string) -> result<_, error>;Sets the request URI.
F get-version
get-version: func() -> result<http-version, error>;Gets the HTTP version of this request.
F set-version
set-version: func(version: http-version) -> result<_, error>;Sets the HTTP version of this request.
F set-auto-decompress-response
set-auto-decompress-response: func(encodings: content-encodings) -> result<_, error>;Sets the content encodings to automatically decompress responses to this request.
If the response to this request is encoded by one of the encodings set by this method, the
response will be presented to the Compute program in decompressed form with the
Content-Encoding and Content-Length headers removed.
Not all of the flags defined in content-encodings are supported. Currently the only
supported flag is content-encodings.gzip.
F redirect-to-websocket-proxy
Passes the WebSocket directly to a backend.
This can only be used on services that have the WebSockets feature enabled and on requests that are valid WebSocket requests.
The sending completes in the background. Once this method has been called, no other response can be sent to this request, and the application can exit without affecting the send.
See the WebSockets passthrough documentation for a high-level description of this feature.
F set-framing-headers-mode
set-framing-headers-mode: func(mode: framing-headers-mode) -> result<_, error>;Sets how the framing headers Content-Length and Transfer-Encoding will be determined
when sending this request.
F redirect-to-grip-proxy
F new
Creates a new request with no method, URL, or headers, and an empty body.