Http module

with_header

procedureextensionexperimental2 overloadsSource

response with one more header: with_header(json(user), "ETag", tag). The name and value must stay valid until the response is written.

Example
response := with_header(text("hi"), "Cache-Control", "no-store");
value, found := find_header(response.headers, "cache-control");
assert(found && value == "no-store");

Doesn't run in the browser (skipped on wasm).

with_header :: (response: Response, name: string, value: string) -> Response

response with one more header: with_header(json(user), "ETag", tag). The name and value must stay valid until the response is written.

Parameters

response: Response
name: string
the header name.
value: string
the header value.

Returns

Example
response := with_header(text("hi"), "Cache-Control", "no-store");
value, found := find_header(response.headers, "cache-control");
assert(found && value == "no-store");

Doesn't run in the browser (skipped on wasm).

with_header :: (error: Http_Error, name: string, value: string) -> Http_Error

error with one more header (Retry-After, WWW-Authenticate...).

Parameters

error: Http_Error
name: string
the header name.
value: string
the header value.

Returns

Example
error := with_header(unavailable("try later"), "Retry-After", "120");
assert(error.headers.count == 1);

Doesn't run in the browser (skipped on wasm).

See also