Class: RequestFactory

RequestFactory

new RequestFactory()

Construct a factory which can create Request objects. Useful for adding "default" handlers to requests.
Source:

Methods

addDefaultRejectCallback(fn)

Add a function which will be invoked for every request that is rejected.
Parameters:
Name Type Description
fn function The function to invoke. The first argument will be the Request object, the second will be the rejection argument.
Source:

addDefaultResolveCallback(fn)

Add a function which will be invoked for every request that is resolved.
Parameters:
Name Type Description
fn function The function to invoke. The first argument will be the Request object, the second will be the resolve argument.
Source:

addDefaultTimeoutCallback(fn, durationMs)

Add a function which will be invoked for every request that has not been resolved or rejected within a certain amount of time.
Parameters:
Name Type Description
fn function The function to invoke. The first argument will be the Request object.
durationMs number The number of milliseconds to wait for a resolution to the request.
Source:

newRequest(optsopt) → {Request}

Generate a new request.
Parameters:
Name Type Attributes Description
opts Object <optional>
The options to pass to the Request constructor, if any.
Source:
Returns:
A new request object
Type
Request