Skip to content

Latest commit

 

History

History
80 lines (42 loc) · 2.73 KB

Agent.md

File metadata and controls

80 lines (42 loc) · 2.73 KB

Agent

Extends: undici.Dispatcher

Agent allow dispatching requests against multiple different origins.

Requests are not guaranteed to be dispatched in order of invocation.

new undici.Agent([options])

Arguments:

  • options AgentOptions (optional)

Returns: Agent

Parameter: AgentOptions

Extends: PoolOptions

  • factory (origin: URL, opts: Object) => Dispatcher - Default: (origin, opts) => new Pool(origin, opts)
  • maxRedirections Integer - Default: 0. The number of HTTP redirection to follow unless otherwise specified in DispatchOptions.
  • interceptors { Agent: DispatchInterceptor[] } - Default: [RedirectInterceptor] - A list of interceptors that are applied to the dispatch method. Additional logic can be applied (such as, but not limited to: 302 status code handling, authentication, cookies, compression and caching). Note that the behavior of interceptors is Experimental and might change at any given time.

Instance Properties

Agent.closed

Implements Client.closed

Agent.destroyed

Implements Client.destroyed

Instance Methods

Agent.close([callback])

Implements Dispatcher.close([callback]).

Agent.destroy([error, callback])

Implements Dispatcher.destroy([error, callback]).

Agent.dispatch(options, handler: AgentDispatchOptions)

Implements Dispatcher.dispatch(options, handler).

Parameter: AgentDispatchOptions

Extends: DispatchOptions

  • origin string | URL
  • maxRedirections Integer.

Implements Dispatcher.destroy([error, callback]).

Agent.connect(options[, callback])

See Dispatcher.connect(options[, callback]).

Agent.dispatch(options, handler)

Implements Dispatcher.dispatch(options, handler).

Agent.pipeline(options, handler)

See Dispatcher.pipeline(options, handler).

Agent.request(options[, callback])

See Dispatcher.request(options [, callback]).

Agent.stream(options, factory[, callback])

See Dispatcher.stream(options, factory[, callback]).

Agent.upgrade(options[, callback])

See Dispatcher.upgrade(options[, callback]).