Type of the options object passed to Http.request.

Fields

@:optionaloptionaltimeout:Null<Int>

A number specifying the socket timeout in milliseconds. This will set the timeout before the socket is connected.

@:optionaloptionalsocketPath:Null<String>

Unix Domain Socket (cannot be used if one of host or port is specified, those specify a TCP Socket).

@:optionaloptionalsetHost:Null<Bool>

Specifies whether or not to automatically add the Host header. Defaults to true.

@:optionaloptionalprotocol:Null<String>

Protocol to use.

Default: 'http:'.

@:optionaloptionalport:Null<Int>

Port of remote server.

Default: defaultPort if set, else 80.

@:optionaloptionalpath:Null<String>

Request path. Should include query string if any. E.G. '/index.html?page=12'. An exception is thrown when the request path contains illegal characters. Currently, only spaces are rejected but that may change in the future.

Default: '/'.

@:optionaloptionalmethod:Null<Method>

A string specifying the HTTP request method.

Default: 'GET'.

@:optionaloptionallocalAddress:Null<String>

Local interface to bind for network connections.

@:optionaloptionalhostname:Null<String>

Alias for host. To support url.parse(), hostname will be used if both host and hostname are specified.

@:optionaloptionalhost:Null<String>

A domain name or IP address of the server to issue the request to.

Default: 'localhost'.

@:optionaloptionalheaders:Null<DynamicAccess<EitherType<String, Array<String>>>>

An object containing request headers.

@:optionaloptionalfamily:Null<DnsAddressFamily>

IP address family to use when resolving host or hostname. Valid values are 4 or 6. When unspecified, both IP v4 and v6 will be used.

@:optionaloptionaldefaultPort:Null<Int>

Default port for the protocol.

Default: agent.defaultPort if an Agent is used, else undefined.

@:optionaloptionalcreateConnection:Null<(options:SocketConnectOptionsTcp, callabck:(err:Error, stream:IDuplex) ‑> Void) ‑> IDuplex>

A function that produces a socket/stream to use for the request when the agent option is not used. This can be used to avoid creating a custom Agent class just to override the default createConnection function. See agent.createConnection() for more details. Any Duplex stream is a valid return value.

@:optionaloptionalauth:Null<String>

Basic authentication i.e. 'user:password' to compute an Authorization header.

@:optionaloptionalagent:Null<EitherType<Agent, Bool>>

Controls Agent behavior.

Possible values:

  • undefined (default): use http.globalAgent for this host and port.
  • Agent object: explicitly use the passed in Agent.
  • false : causes a new Agent with default values to be used.