Pipeline interface

Represents a pipeline for making a HTTP request to a URL. Pipelines can have multiple policies to manage manipulating each request before and after it is made to the server.

Methods

addPolicy(PipelinePolicy, AddPolicyOptions)

Add a new policy to the pipeline.

clone()

Duplicates this pipeline to allow for modifying an existing one without mutating it.

getOrderedPolicies()

Returns the current set of policies in the pipeline in the order in which they will be applied to the request. Later in the list is closer to when the request is performed.

removePolicy({ name?: string, phase?: PipelinePhase })

Remove a policy from the pipeline.

sendRequest(HttpClient, PipelineRequest)

Uses the pipeline to make a HTTP request.

Method Details

addPolicy(PipelinePolicy, AddPolicyOptions)

Add a new policy to the pipeline.

function addPolicy(policy: PipelinePolicy, options?: AddPolicyOptions)

Parameters

policy
PipelinePolicy

A policy that manipulates a request.

options
AddPipelineOptions

A set of options for when the policy should run.

clone()

Duplicates this pipeline to allow for modifying an existing one without mutating it.

function clone(): Pipeline

Returns

getOrderedPolicies()

Returns the current set of policies in the pipeline in the order in which they will be applied to the request. Later in the list is closer to when the request is performed.

function getOrderedPolicies(): PipelinePolicy[]

Returns

removePolicy({ name?: string, phase?: PipelinePhase })

Remove a policy from the pipeline.

function removePolicy(options: { name?: string, phase?: PipelinePhase }): PipelinePolicy[]

Parameters

options

{ name?: string, phase?: PipelinePhase }

Options that let you specify which policies to remove.

Returns

sendRequest(HttpClient, PipelineRequest)

Uses the pipeline to make a HTTP request.

function sendRequest(httpClient: HttpClient, request: PipelineRequest): Promise<PipelineResponse>

Parameters

httpClient
HttpClient

The HttpClient that actually performs the request.

request
PipelineRequest

The request to be made.

Returns

Promise<PipelineResponse>