Skip to content
FutureBlitz

    Install

    Import std.net.http.work

    std.net.http.work

    Work routes' threads: a blocking handler, which computes or waits, runs on one of a server's Workers threads, given a Sendable copy of its request, while the main thread goes on answering the others; what it gives goes back to the main thread as a Sendable copy too, which the connection's response is made from.

    std/net/http/work.fb

    Types

    WorkHandler alias

    Public Alias WorkHandler = Sendable Func(WorkRequest): HttpResponse

    What a work route runs, on a Workers thread: a blocking function of a copy of the request, which gives the response.

    std/net/http/work.fb, line 21

    WorkRequest struct

    Public Struct WorkRequest

    A copy of a request that a work route's handler gets on another thread: what HttpRequest has but the connection, as Sendable values.

    std/net/http/work.fb, line 25

    • Public ReadOnly Field Verb: String field #

      Its method, as the client wrote it, like "GET".

    • Public ReadOnly Field Target: String field #

      Its target, as the client wrote it.

    • Public ReadOnly Field Path: String field #

      Its target's path, percent-encoded, without dot segments.

    • Public ReadOnly Field Version: String field #

      "HTTP/1.1" or "HTTP/1.0".

    • Public ReadOnly Field RemoteAddress: String field #

      The client's address.

    • Public ReadOnly Field Bytes: ImmutableArray<UInt8> field #

      Its body's bytes.

    • Public Property Headers: Headers property #

      Its headers, new Headers each time, made on the thread that asks.

    • Public Property Query: QueryParams property #

      Its query's names and values, a new QueryParams each time.

    • Public Property Text: String property #

      The body as text, its UTF-8, with U+FFFD for each byte that doesn't start well-formed UTF-8.

    • Public Method Param(name: String): String? method #

      A path parameter its route bound, percent-decoded, or Null when it has none of that name.

    • Public Property Params: Map<String, String> property #

      Each path parameter its route bound, by name, a new Map each time.

    • Public Method Form(): QueryParams method #

      A form's fields, when the body is application/x-www-form-urlencoded, or none.

    Report an issue with this page or with FutureBlitz on GitHub.