Describes a request.
client should be a BaseClient instance.
method can be any HTTP method, as understood by the transport responsible
for actually issuing the request.
Throws TypeError instances if illegal options are provided.
Overrides client.pathname. If given must be a non-empty string. Cannot
contain a ? search component, use the query option instead.
Mixes with client.query. If given, parameters from this option will replace
those specified in the client.
Parameter names must not be empty strings. Values can be strings, finite numbers, and booleans. They'll be cast to strings if necessary.
Mixes with client.headers. If given, headers from this option will replace
those specified in the client.
Header names are downcased and may not be the same as other downcased names. They must not be empty strings either.
Values can be strings, finite numbers, and booleans. They'll be cast to strings if necessary. Values may be arrays, in which case each item will still need to be a string, finite number, or boolean. Again they'll be cast to strings if necessary. Array values are not allowed to include other arrays.
Overrides client.auth.
Only one of stream, chunk, json and form can be provided. Note that
whether a body should be provided depends on the HTTP method used.
Provides a stream that can be piped to the service. Must be an object with a
pipe method.
Provides a single Buffer instance that can be written to the service.
Provides a value that can be converted to JSON and sent to the service
using utf8 encoding. If no content-type header is set, will set one
according to Request#DEFAULT_JSON_CONTENT_TYPE.
Provides an object that can be URL-encoded and sent to the service using
utf8 encoding. If no content-type header is set, will set one according
to Request#DEFAULT_FORM_CONTENT_TYPE.
Parameter names must not be empty strings. Values can be strings, finite numbers, and booleans. They'll be cast to strings if necessary.
HTTP method.
Path value, consisting of a pathname and an optional search component.
Headers object. All keys will are lowercased.
Body object. null if no body needs to be sent to the service. Has either
a stream property, containing a stream that can be piped, or a chunk
property, containing a Buffer instance.
Authorization credential.
Default content-type header for JSON bodies.
Default content-type header for form bodies.
Builds the path. If provided, options.pathname is used, otherwise
defaultPathname. Combines options.query with baseQuery for the search
component.
Throws TypeError instances if illegal options are provided.
Builds a flat list of alternating parameters and values. base is expected
to be the initial list, query an optional object that augments or overrides
the base parameters.
Throws TypeError instances if illegal options are provided.
Builds an object of all headers. base is expected to be the initial list,
options can optionally contain a headers object that augments or
overrides the base headers.
Throws TypeError instances if illegal options are provided.
Builds an object describing the body. See the body options above.
Throws TypeError instances if illegal options are provided.
Builds the authorization credential. Returns options.auth if provided, else
just auth.
Request(client, method, options)