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";Constructor
Section titled “Constructor”HTTPClient(options)
Section titled “HTTPClient(options)”Creates a new HTTPClient object instance.
HTTPClient(options)Parameters
Section titled “Parameters”options
socket- An object containing aTCPclass 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) - ADomain Name Resolverclass constructor options object to use to resolve the host.
Instance Methods
Section titled “Instance Methods”request(options)
Section titled “request(options)”Queues an HTTP request described by the required options object.
close()
Section titled “close()”Cancels all outstanding requests and releases resources.