Skip to content

HttpRequest

1 min read

Import: import system.net;

Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.

HttpRequest

Mutable request description; sending snapshots URL, headers, options, and body bytes.

public class HttpRequest

method

HTTP method, restricted to GET/POST/PUT/PATCH/DELETE/HEAD/OPTIONS on all hosts.

public method: HttpMethod

url

Absolute http/https destination; credentials in URLs are rejected.

public url: Url

headers

Request headers; browsers reject forbidden names instead of silently ignoring them.

public headers: HttpHeaders

body

Byte body copied for each send; GET and HEAD require an empty body.

public body: byte[]

constructor

Creates a request with empty headers and body.

public constructor(method: HttpMethod, url: Url)

set_text

Replaces the body with UTF-8 bytes; adds no content-type header implicitly.

public fun set_text(text: string): void