Skip to content

HTTP Client Class Pattern

The HTTP Client Class Pattern makes one or more HTTP/1.1 requests to a single host.

import HTTPClient from "embedded:network/http/client";

Creates a new HTTPClient object instance.

HTTPClient(options)

options

socket - An object containing a TCP class constructor options object.

port (optional) - The remote port number to connect to. Defaults to 80.

host - The remote hostname to connect to as a string.

dns (optional) - A Domain Name Resolver class constructor options object to use to resolve the host.

Queues an HTTP request described by the required options object.

Cancels all outstanding requests and releases resources.

HTTP Client Class Pattern