Module http/index
HTTP/1.1 — the module you import. It is a barrel: it re-exports
./http.yo (the pure types and parsers), ./client.yo (fetch /
fetch_with) and ./server.yo (HttpServer over TcpListener), so
import("std/http") gives the whole surface.
./wire.yo is deliberately NOT re-exported. Message framing —
Content-Length, chunked decoding, and what a read leaves behind — is
shared by the client and the server but is not a public API: it is
std-internal so that the framing rules can change with the pooling work
without that being a breaking change to std/http.
{ fetch } :: import("std/http");
{ IoExn } :: import("std/error");
resp := io.await(fetch(`http://example.com`, io), IoExn(io : io, exn : exn));
println(resp.body);
Stability
unstable, and it inherits rather than owns that: this file declares no
members of its own, so its stability is exactly the union of the three
modules it fronts, each of which carries its own ## Stability section
and its own open question — connection pooling in ./client.yo, the
get_header/HeaderMap duplication in ./http.yo, and the idle timeout
./server.yo needs before it can hold a connection open. What IS stable
about this file is the barrel shape: import("std/http") will keep
exporting those three modules, and adding a fourth would be additive.
Types
HTTP client error variants.
Variants
| Variant | Fields | Description |
|---|---|---|
ConnectionFailed | msg: String | Failed to connect to the remote host. |
InvalidUrl | msg: String | The URL could not be parsed. |
Timeout | The whole request (every connect, write, read and redirect hop) did not
finish within | |
TooManyRedirects | The server kept redirecting past | |
UnsupportedScheme | scheme: String | The URL scheme is neither |
ResponseTooLarge | The raw response (status line, headers and body) grew past
| |
MalformedChunkedBody | msg: String | A |
MalformedContentLength | msg: String | A |
Other | msg: String | An unclassified HTTP error. |
Trait Implementations
impl(generic(T : Type), where(T <: ToString), T : (ToString))
impl(generic(T : Type), where(T <: ToString), T : (ToString), Format)
format : fn(self : Self, spec : str) -> StringRender self under spec. An unrecognised spec degrades to the plain
to_string() rendering rather than failing.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
spec | str |
Returns: String
Methods
to_string : (HttpError) fn(self : HttpError) -> Stringsource : (HttpError) fn(self : HttpError) -> Option(dyn( + ToString))The error that caused this one, or .None at the root of the chain.
Rust's Error::source. Defaulted to .None, so an error with nothing
underneath it implements the trait by saying only what it is; a wrapper
overrides it to hand back what it wrapped. Walking the chain to the root
cause is not expressible yet — the returned Dyn loses the Error
trait on an erased receiver, so a caller can print one link but cannot
follow it (#521,
issues/self-trait-in-a-return-type-loses-the-trait-on-an-erased-receiver.md).
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpError |
Standard HTTP request methods.
Variants
| Variant | Fields | Description |
|---|---|---|
GET | ||
POST | ||
PUT | ||
DELETE | ||
HEAD | ||
PATCH | ||
OPTIONS |
Trait Implementations
impl(generic(T : Type), where(T <: ToString), T : (ToString))
impl(generic(T : Type), where(T <: ToString), T : (ToString), Format)
format : fn(self : Self, spec : str) -> StringRender self under spec. An unrecognised spec degrades to the plain
to_string() rendering rather than failing.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
spec | str |
Returns: String
Methods
to_string : (HttpMethod) fn(self : HttpMethod) -> StringSerialize to wire format, on the status line's own version (so a
parsed response round-trips). A Content-Length header is added
when none is present (the byte length of body), so the peer can
delimit the message without waiting for close.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpMethod |
Returns: String
from_string : (HttpMethod) fn(s : String) -> Option(HttpMethod)Parse a request-line method token (case-sensitive, as RFC 9110 §9.1
requires). .None for anything not in the enum.
Parameters
| Name | Type | Notes |
|---|---|---|
s | String |
Returns: Option(HttpMethod)
An HTTP header as a name-value pair.
Fields
| Name | Type | Description |
|---|---|---|
name | String | |
value | String |
Methods
new : (HttpHeader) fn(name : String, value : String) -> HttpHeaderCreate a response with the given status and reason phrase.
Parameters
| Name | Type | Notes |
|---|---|---|
name | String | |
value | String |
Returns: HttpHeader
A header section — Rust's http::HeaderMap.
Two properties HTTP requires and a HashMap(String, String) cannot give:
- field names are case-insensitive (RFC 9110 §5.1), so
Content-Typeandcontent-typeare the same field. Comparison folds ASCII case; the name is STORED as written, because that is what goes on the wire. - a field may appear more than once (
Set-Cookiealways does), and the order of the repeated values is significant. So this is a multimap that preserves insertion order, backed by a list rather than a hash table.
insert replaces every existing value for a name, append adds one — the
same split Rust draws, and the reason set_header on a request used to
silently accumulate duplicates.
Fields
| Name | Type | Description |
|---|---|---|
_entries | ArrayList(HttpHeader) |
Trait Implementations
impl(generic(T : Type), where(T <: ToString), T : (ToString))
impl(generic(T : Type), where(T <: ToString), T : (ToString), Format)
format : fn(self : Self, spec : str) -> StringRender self under spec. An unrecognised spec degrades to the plain
to_string() rendering rather than failing.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
spec | str |
Returns: String
Methods
new : (HeaderMap) fn() -> HeaderMapCreate a response with the given status and reason phrase.
Returns: HeaderMap
len : (HeaderMap) fn(self : HeaderMap) -> usizeNumber of field LINES, counting each repeat of a name separately.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HeaderMap |
Returns: usize
is_empty : (HeaderMap) fn(self : HeaderMap) -> boolget : (HeaderMap) fn(self : HeaderMap, name : String) -> Option(String)get_all : (HeaderMap) fn(self : HeaderMap, name : String) -> ArrayList(String)contains_key : (HeaderMap) fn(self : HeaderMap, name : String) -> boolappend : (HeaderMap) fn(self : HeaderMap, name : String, value : String) -> unitremove : (HeaderMap) fn(self : HeaderMap, name : String) -> usizeinsert : (HeaderMap) fn(self : HeaderMap, name : String, value : String) -> Option(String)entries : (HeaderMap) fn(self : HeaderMap) -> ArrayList(HttpHeader)The field lines in order — for serialization and iteration. The list is a snapshot: pushing to it does not change the map.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HeaderMap |
Returns: ArrayList(HttpHeader)
to_string : (HeaderMap) fn(self : HeaderMap) -> StringAn HTTP status code — Rust's http::StatusCode.
A u16 newtype rather than a bare integer, so the CLASS predicates
(is_success, is_client_error, ...) live with the value instead of being
re-derived at every call site, and so a status cannot be confused with a
port, a length or a byte count. u16 because RFC 9110 SS15 fixes the range
at three digits: a status is never negative, which an i32 allowed.
Fields
| Name | Type | Description |
|---|---|---|
code | u16 |
Trait Implementations
impl(generic(T : Type), where(T <: ToString), T : (ToString))
impl(generic(T : Type), where(T <: ToString), T : (ToString), Format)
format : fn(self : Self, spec : str) -> StringRender self under spec. An unrecognised spec degrades to the plain
to_string() rendering rather than failing.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
spec | str |
Returns: String
Methods
from_u16 : (StatusCode) fn(code : u16) -> Option(StatusCode)Wrap a raw code, or .None when it is outside the 100-599 range RFC 9110
SS15 defines. An unrecognized code INSIDE the range is accepted — a client
must treat an unknown 4xx as 400, so refusing it would break the very
forward-compatibility the classes exist for.
Parameters
| Name | Type | Notes |
|---|---|---|
code | u16 |
Returns: Option(StatusCode)
as_u16 : (StatusCode) fn(self : StatusCode) -> u16is_informational : (StatusCode) fn(self : StatusCode) -> bool1xx — the request was received and the process continues.
Parameters
| Name | Type | Notes |
|---|---|---|
self | StatusCode |
Returns: bool
is_success : (StatusCode) fn(self : StatusCode) -> boolis_redirection : (StatusCode) fn(self : StatusCode) -> bool3xx — further action is needed to complete the request.
Parameters
| Name | Type | Notes |
|---|---|---|
self | StatusCode |
Returns: bool
is_client_error : (StatusCode) fn(self : StatusCode) -> bool4xx — the request was malformed or cannot be fulfilled.
Parameters
| Name | Type | Notes |
|---|---|---|
self | StatusCode |
Returns: bool
is_server_error : (StatusCode) fn(self : StatusCode) -> bool5xx — the server failed to fulfil an apparently valid request.
Parameters
| Name | Type | Notes |
|---|---|---|
self | StatusCode |
Returns: bool
is_error : (StatusCode) fn(self : StatusCode) -> boolreason : (StatusCode) fn(self : StatusCode) -> StringThe reason phrase RFC 9110 registers for this code, or Unknown.
The phrase is ADVISORY: a server may send any text and a client must not
act on it — which is why this is a lookup here rather than a field, and
why HttpResponse keeps whatever phrase the peer actually sent.
Parameters
| Name | Type | Notes |
|---|---|---|
self | StatusCode |
Returns: String
to_string : (StatusCode) fn(self : StatusCode) -> StringSerialize to wire format, on the status line's own version (so a
parsed response round-trips). A Content-Length header is added
when none is present (the byte length of body), so the peer can
delimit the message without waiting for close.
Parameters
| Name | Type | Notes |
|---|---|---|
self | StatusCode |
Returns: String
== : (StatusCode) fn(lhs : StatusCode, rhs : StatusCode) -> bool!= : (StatusCode) fn(lhs : StatusCode, rhs : StatusCode) -> bool< : (StatusCode) fn(lhs : StatusCode, rhs : StatusCode) -> bool<= : (StatusCode) fn(lhs : StatusCode, rhs : StatusCode) -> bool> : (StatusCode) fn(lhs : StatusCode, rhs : StatusCode) -> bool>= : (StatusCode) fn(lhs : StatusCode, rhs : StatusCode) -> boolcmp : (StatusCode) fn(lhs : StatusCode, rhs : StatusCode) -> OrderingOK : (StatusCode) fn() -> StatusCodeReturns: StatusCode
CREATED : (StatusCode) fn() -> StatusCodeReturns: StatusCode
ACCEPTED : (StatusCode) fn() -> StatusCodeReturns: StatusCode
NO_CONTENT : (StatusCode) fn() -> StatusCodeReturns: StatusCode
MOVED_PERMANENTLY : (StatusCode) fn() -> StatusCodeReturns: StatusCode
FOUND : (StatusCode) fn() -> StatusCodeReturns: StatusCode
NOT_MODIFIED : (StatusCode) fn() -> StatusCodeReturns: StatusCode
TEMPORARY_REDIRECT : (StatusCode) fn() -> StatusCodeReturns: StatusCode
PERMANENT_REDIRECT : (StatusCode) fn() -> StatusCodeReturns: StatusCode
BAD_REQUEST : (StatusCode) fn() -> StatusCodeReturns: StatusCode
UNAUTHORIZED : (StatusCode) fn() -> StatusCodeReturns: StatusCode
FORBIDDEN : (StatusCode) fn() -> StatusCodeReturns: StatusCode
NOT_FOUND : (StatusCode) fn() -> StatusCodeReturns: StatusCode
METHOD_NOT_ALLOWED : (StatusCode) fn() -> StatusCodeReturns: StatusCode
CONFLICT : (StatusCode) fn() -> StatusCodeReturns: StatusCode
CONTENT_TOO_LARGE : (StatusCode) fn() -> StatusCodeReturns: StatusCode
TOO_MANY_REQUESTS : (StatusCode) fn() -> StatusCodeReturns: StatusCode
INTERNAL_SERVER_ERROR : (StatusCode) fn() -> StatusCodeReturns: StatusCode
NOT_IMPLEMENTED : (StatusCode) fn() -> StatusCodeReturns: StatusCode
BAD_GATEWAY : (StatusCode) fn() -> StatusCodeReturns: StatusCode
SERVICE_UNAVAILABLE : (StatusCode) fn() -> StatusCodeReturns: StatusCode
GATEWAY_TIMEOUT : (StatusCode) fn() -> StatusCodeReturns: StatusCode
An HTTP request with method, path, headers, and optional body.
Fields
| Name | Type | Description |
|---|---|---|
method | HttpMethod | |
path | String | |
headers | HeaderMap | The response's header fields, in the order they arrived. A multimap:
use |
body | String | The body as received, byte-transparent — it is sliced out of the raw
message on the CRLFCRLF boundary and wrapped without UTF-8 validation,
so a binary body survives (a |
Trait Implementations
impl(generic(T : Type), where(T <: ToString), T : (ToString))
impl(generic(T : Type), where(T <: ToString), T : (ToString), Format)
format : fn(self : Self, spec : str) -> StringRender self under spec. An unrecognised spec degrades to the plain
to_string() rendering rather than failing.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
spec | str |
Returns: String
Methods
new : (HttpRequest) fn(method : HttpMethod, path : String) -> HttpRequestCreate a response with the given status and reason phrase.
Parameters
| Name | Type | Notes |
|---|---|---|
method | HttpMethod | |
path | String |
Returns: HttpRequest
header : (HttpRequest) fn(self : HttpRequest, name : String, value : String) -> HttpRequestAdd a header and return the response (builder pattern). APPENDS, so a repeatable field can be built up by chaining.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpRequest | |
name | String | |
value | String |
Returns: HttpRequest
with_body : (HttpRequest) fn(self : HttpRequest, body : String) -> HttpRequestSet the body and return the response (builder pattern).
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpRequest | |
body | String |
Returns: HttpRequest
set_host : (HttpRequest) fn(self : HttpRequest, host : String) -> unitSet the Host header, REPLACING any existing one — there is exactly one Host per request (RFC 9112 SS3.2), and appending a second used to put both on the wire.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpRequest | |
host | String |
Returns: unit
set_header : (HttpRequest) fn(self : HttpRequest, name : String, value : String) -> unitSet a header, REPLACING every existing value for that name.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpRequest | |
name | String | |
value | String |
Returns: unit
set_body : (HttpRequest) fn(self : HttpRequest, body : String) -> unitget_header : (HttpRequest) fn(self : HttpRequest, name : String) -> Option(String)Look up a header value by name (case-insensitive). The first value, when
the field repeats — self.headers.get_all(name) for all of them, which
is what Set-Cookie needs.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpRequest | |
name | String |
to_string : (HttpRequest) fn(self : HttpRequest) -> StringSerialize to wire format, on the status line's own version (so a
parsed response round-trips). A Content-Length header is added
when none is present (the byte length of body), so the peer can
delimit the message without waiting for close.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpRequest |
Returns: String
An HTTP response with status, headers, and body.
Fields
| Name | Type | Description |
|---|---|---|
status | StatusCode | The status. A |
status_text | String | The reason phrase as the peer sent it, which may be anything (RFC 9110
§15 makes it advisory). |
version | String | The version on the status line, as received — |
headers | HeaderMap | The response's header fields, in the order they arrived. A multimap:
use |
body | String | The body as received, byte-transparent — it is sliced out of the raw
message on the CRLFCRLF boundary and wrapped without UTF-8 validation,
so a binary body survives (a |
Trait Implementations
impl(generic(T : Type), where(T <: ToString), T : (ToString))
impl(generic(T : Type), where(T <: ToString), T : (ToString), Format)
format : fn(self : Self, spec : str) -> StringRender self under spec. An unrecognised spec degrades to the plain
to_string() rendering rather than failing.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
spec | str |
Returns: String
Methods
new : (HttpResponse) fn(status : StatusCode, status_text : String) -> HttpResponseCreate a response with the given status and reason phrase.
Parameters
| Name | Type | Notes |
|---|---|---|
status | StatusCode | |
status_text | String |
Returns: HttpResponse
get_header : (HttpResponse) fn(self : HttpResponse, name : String) -> Option(String)Look up a header value by name (case-insensitive). The first value, when
the field repeats — self.headers.get_all(name) for all of them, which
is what Set-Cookie needs.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpResponse | |
name | String |
set_header : (HttpResponse) fn(self : HttpResponse, name : String, value : String) -> unitSet a header, REPLACING every existing value for that name.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpResponse | |
name | String | |
value | String |
Returns: unit
is_ok : (HttpResponse) fn(self : HttpResponse) -> boolis_redirect : (HttpResponse) fn(self : HttpResponse) -> boolis_error : (HttpResponse) fn(self : HttpResponse) -> boolwith_status : (HttpResponse) fn(status : StatusCode) -> HttpResponseA response with status and its registered reason phrase.
Parameters
| Name | Type | Notes |
|---|---|---|
status | StatusCode |
Returns: HttpResponse
header : (HttpResponse) fn(self : HttpResponse, name : String, value : String) -> HttpResponseAdd a header and return the response (builder pattern). APPENDS, so a repeatable field can be built up by chaining.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpResponse | |
name | String | |
value | String |
Returns: HttpResponse
with_body : (HttpResponse) fn(self : HttpResponse, body : String) -> HttpResponseSet the body and return the response (builder pattern).
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpResponse | |
body | String |
Returns: HttpResponse
to_string : (HttpResponse) fn(self : HttpResponse) -> StringSerialize to wire format, on the status line's own version (so a
parsed response round-trips). A Content-Length header is added
when none is present (the byte length of body), so the peer can
delimit the message without waiting for close.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpResponse |
Returns: String
Why a raw HTTP message did not parse — the error of parse_request and
parse_response, which are pure decoders and so return Result (D13).
Each variant carries the offending text; to_string renders the line a
server puts in its 400 body. Until 2026-09-06 the two functions returned
Result(_, String), the one std shape a caller could neither match on nor
distinguish from any other string
(issues/fixed/http-parse-errors-were-bare-strings.md).
Variants
| Variant | Fields | Description |
|---|---|---|
Empty | No start line at all. | |
InvalidStatusLine | line: String | A response whose first line is not |
InvalidStatusCode | text: String | A status code that is not an integer. |
InvalidRequestLine | line: String | A request line that is not exactly |
UnknownMethod | name: String | A request method outside |
UnsupportedVersion | version: String | A request version other than |
InvalidHeaderLine | line: String | A header line without a |
Trait Implementations
impl(generic(T : Type), where(T <: ToString), T : (ToString))
impl(generic(T : Type), where(T <: ToString), T : (ToString), Format)
format : fn(self : Self, spec : str) -> StringRender self under spec. An unrecognised spec degrades to the plain
to_string() rendering rather than failing.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
spec | str |
Returns: String
Methods
to_string : (HttpParseError) fn(self : HttpParseError) -> StringSerialize to wire format, on the status line's own version (so a
parsed response round-trips). A Content-Length header is added
when none is present (the byte length of body), so the peer can
delimit the message without waiting for close.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpParseError |
Returns: String
source : (HttpParseError) fn(self : HttpParseError) -> Option(dyn( + ToString))The error that caused this one, or .None at the root of the chain.
Rust's Error::source. Defaulted to .None, so an error with nothing
underneath it implements the trait by saying only what it is; a wrapper
overrides it to hand back what it wrapped. Walking the chain to the root
cause is not expressible yet — the returned Dyn loses the Error
trait on an erased receiver, so a caller can print one link but cannot
follow it (#521,
issues/self-trait-in-a-return-type-loses-the-trait-on-an-erased-receiver.md).
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpParseError |
Options for configuring an HTTP request.
Fields
| Name | Type | Description |
|---|---|---|
method | HttpMethod | |
headers | HeaderMap | |
body | String | |
timeout | Option(Duration) | Deadline for the WHOLE request, redirects included — |
max_redirects | usize | How many 3xx |
max_response_bytes | usize | Ceiling on the raw response bytes (headers + body) buffered into
memory before |
Methods
new : (FetchOptions) fn() -> FetchOptionsCreate default options (GET, no headers, empty body, no timeout, 10 redirects, 64 MiB response ceiling).
Returns: FetchOptions
with_method : (FetchOptions) fn(self : FetchOptions, method : HttpMethod) -> FetchOptionsSet the HTTP method.
Parameters
| Name | Type | Notes |
|---|---|---|
self | FetchOptions | |
method | HttpMethod |
Returns: FetchOptions
with_header : (FetchOptions) fn(self : FetchOptions, name : String, value : String) -> FetchOptionsAdd a request header.
Parameters
| Name | Type | Notes |
|---|---|---|
self | FetchOptions | |
name | String | |
value | String |
Returns: FetchOptions
with_body : (FetchOptions) fn(self : FetchOptions, body : String) -> FetchOptionswith_timeout : (FetchOptions) fn(self : FetchOptions, limit : Duration) -> FetchOptionsGive the whole request (redirects included) a deadline.
Parameters
| Name | Type | Notes |
|---|---|---|
self | FetchOptions | |
limit | Duration |
Returns: FetchOptions
with_max_redirects : (FetchOptions) fn(self : FetchOptions, n : usize) -> FetchOptionsCap the number of redirect hops followed (0 = return 3xx verbatim).
Parameters
| Name | Type | Notes |
|---|---|---|
self | FetchOptions | |
n | usize |
Returns: FetchOptions
with_max_response_bytes : (FetchOptions) fn(self : FetchOptions, n : usize) -> FetchOptionsCap the raw response bytes buffered into memory (0 = unlimited).
Parameters
| Name | Type | Notes |
|---|---|---|
self | FetchOptions | |
n | usize |
Returns: FetchOptions
An HTTP/1.1 server bound to a TcpListener.
Fields
| Name | Type | Description |
|---|---|---|
listener | TcpListener | |
max_request_bytes | usize | Requests larger than this are answered with |
stopped | bool |
Methods
bind : (HttpServer) fn(addr : SocketAddr, io : Io) -> Impl : (Future[Future](HttpServer) IoExn : IoExn)Bind a listening socket on addr (port 0 picks a free port — read it
back with local_addr()).
Parameters
| Name | Type | Notes |
|---|---|---|
addr | SocketAddr | |
io | Io |
Returns: Impl : (Future[Future](HttpServer) IoExn : IoExn)
local_addr : (HttpServer) fn(self : HttpServer) -> SocketAddrwith_max_request_bytes : (HttpServer) fn(self : HttpServer, n : usize) -> HttpServerSet the request-size ceiling (builder pattern; 0 = unlimited).
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpServer | |
n | usize |
Returns: HttpServer
serve_once : (HttpServer) fn(self : HttpServer, handler : Impl : (Fn(HttpRequest) -> HttpResponse), io : Io) -> Impl : (Future[Future](unit) IoExn : IoExn)Accept ONE connection, read one request, run handler, write the
response and close. A request that does not parse gets a 400 Bad Request whose body names the defect, without calling handler; a
framing defect (oversize, unreadable Content-Length, malformed
chunking) is answered the same way (413 for oversize) instead of being
thrown out of the server
(issues/fixed/one-malformed-request-killed-http-server-serve.md).
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpServer | |
handler | Impl : (Fn(HttpRequest) -> HttpResponse) | |
io | Io |
serve : (HttpServer) fn(self : HttpServer, handler : Impl : (Fn(HttpRequest) -> HttpResponse), io : Io) -> Impl : (Future[Future](unit) IoExn : IoExn)Serve connections one after another until stop() has been called
(checked after each connection completes).
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpServer | |
handler | Impl : (Fn(HttpRequest) -> HttpResponse) | |
io | Io |
stop : (HttpServer) fn(self : HttpServer) -> unitAsk serve to return after the connection it is currently handling.
Parameters
| Name | Type | Notes |
|---|---|---|
self | HttpServer |
Returns: unit
close : (HttpServer) fn(self : HttpServer, io : Io) -> Impl : (Future[Future](unit) IoExn : IoExn)Functions
Parameters
| Name | Type | Notes |
|---|---|---|
raw | String |
Returns: Result(HttpResponse, HttpParseError)
Parameters
| Name | Type | Notes |
|---|---|---|
raw | String |
Returns: Result(HttpRequest, HttpParseError)
Parameters
| Name | Type | Notes |
|---|---|---|
url_str | String | |
opts | FetchOptions | |
io | Io |
Returns: Impl : (Future[Future](HttpResponse) IoExn : IoExn)
Constants
Value: 10
Value: 67108864
Value: 16777216