Standard library
HTTP client
HTTP and HTTPS client requests.
Introduction
HTTP and HTTPS client requests. Import std/net/http_client to bind the module as http_client. Call free functions as http_client.name(...). Struct methods use a receiver value.
/ std/net/http_client
This page is the package reference for std/net/http_client. Private helpers used only by co-located tests are not listed.
Functions
Free functions on http_client. Each function has a short description, an example, then parameters and return shape.
get
Performs an HTTP GET over cleartext TCP. Call form: http_client.get(host, port, path).
/ std/net/http_client
$ res = http_client.get("example.com", 80, "/")Parameters: host: host name. port: port number. path: request path. Returns: Response product or failure shape (see description).
request
Performs an HTTP request over cleartext TCP. Call form: http_client.request(method, host, port, path, headers, body).
/ std/net/http_client
$ res = http_client.request("example.com", 80, "GET", "/", {}, "")Parameters: host: host name. port: port number. method: HTTP method. path: request path. headers: header product. body: body text. Returns: Response product or failure shape.
get_tls
Performs an HTTPS GET using TLS. Call form: http_client.get_tls(host, port, path, server_name, ca_pem).
/ std/net/http_client
$ res = http_client.get_tls("example.com", 443, "/")Parameters: host: host name. port: port number. path: request path. Returns: Response product or failure shape.
request_tls
Performs an HTTPS request using TLS. Call form: http_client.request_tls(method, host, port, path, headers, body, server_name, ca_pem).
/ std/net/http_client
$ res = http_client.request_tls("example.com", 443, "GET", "/", {}, "")Parameters: host: host name. port: port number. method: HTTP method. path: request path. headers: header product. body: body text. Returns: Response product or failure shape.