Show / Hide Table of Contents

Class HttpPipeline

Represents a primitive for sending HTTP requests and receiving responses extensible by adding HttpPipelinePolicy processing steps.

Inheritance
System.Object
HttpPipeline
DisposableHttpPipeline
Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Core.dll
Syntax
public class HttpPipeline

Constructors

HttpPipeline(HttpPipelineTransport, HttpPipelinePolicy[], ResponseClassifier)

Creates a new instance of HttpPipeline with the provided transport, policies and response classifier.

Declaration
public HttpPipeline (Azure.Core.Pipeline.HttpPipelineTransport transport, Azure.Core.Pipeline.HttpPipelinePolicy[] policies = null, Azure.Core.ResponseClassifier responseClassifier = null);
Parameters
HttpPipelineTransport transport

The HttpPipelineTransport to use for sending the requests.

HttpPipelinePolicy[] policies

Policies to be invoked as part of the pipeline in order.

ResponseClassifier responseClassifier

The response classifier to be used in invocations.

Properties

ResponseClassifier

The ResponseClassifier instance used in this pipeline invocations.

Declaration
public Azure.Core.ResponseClassifier ResponseClassifier { get; }
Property Value
ResponseClassifier

Methods

CreateClientRequestIdScope(String)

Creates a scope in which all outgoing requests would use the provided

Declaration
public static IDisposable CreateClientRequestIdScope (string clientRequestId);
Parameters
System.String clientRequestId

The client request id value to be sent with request.

Returns
System.IDisposable

The System.IDisposable instance that needs to be disposed when client request id shouldn't be sent anymore.

Examples

Sample usage:


 var secretClient = new SecretClient(new Uri("http://example.com"), new DefaultAzureCredential());

 using (HttpPipeline.CreateClientRequestIdScope("<custom-client-request-id>"))
 {
     // The HTTP request resulting from the client call would have x-ms-client-request-id value set to <custom-client-request-id>
     secretClient.GetSecret("<secret-name>");
 }
 

CreateHttpMessagePropertiesScope(IDictionary<String,Object>)

Creates a scope in which all HttpMessages would have provided properties.

Declaration
public static IDisposable CreateHttpMessagePropertiesScope (System.Collections.Generic.IDictionary<string,object> messageProperties);
Parameters
System.Collections.Generic.IDictionary<System.String,System.Object> messageProperties

Properties to be added to HttpMessages

Returns
System.IDisposable

The System.IDisposable instance that needs to be disposed when properties shouldn't be used anymore.

CreateMessage()

Creates a new HttpMessage instance.

Declaration
public Azure.Core.HttpMessage CreateMessage ();
Returns
HttpMessage

The message.

CreateMessage(RequestContext)

Declaration
public Azure.Core.HttpMessage CreateMessage (Azure.RequestContext context);
Parameters
RequestContext context

Returns
HttpMessage

CreateMessage(RequestContext, ResponseClassifier)

Creates a new HttpMessage instance.

Declaration
public Azure.Core.HttpMessage CreateMessage (Azure.RequestContext context, Azure.Core.ResponseClassifier classifier = null);
Parameters
RequestContext context

Context specifying the message options.

ResponseClassifier classifier

Returns
HttpMessage

The message.

CreateRequest()

Creates a new Request instance.

Declaration
public Azure.Core.Request CreateRequest ();
Returns
Request

The request.

Send(HttpMessage, CancellationToken)

Invokes the pipeline synchronously. After the task completes response would be set to the Response property.

Declaration
public void Send (Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken);
Parameters
HttpMessage message

The HttpMessage to send.

System.Threading.CancellationToken cancellationToken

The System.Threading.CancellationToken to use.

SendAsync(HttpMessage, CancellationToken)

Invokes the pipeline asynchronously. After the task completes response would be set to the Response property.

Declaration
public System.Threading.Tasks.ValueTask SendAsync (Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken);
Parameters
HttpMessage message

The HttpMessage to send.

System.Threading.CancellationToken cancellationToken

The System.Threading.CancellationToken to use.

Returns
System.Threading.Tasks.ValueTask

The System.Threading.Tasks.ValueTask representing the asynchronous operation.

SendRequest(Request, CancellationToken)

Invokes the pipeline synchronously with the provided request.

Declaration
public Azure.Response SendRequest (Azure.Core.Request request, System.Threading.CancellationToken cancellationToken);
Parameters
Request request

The Request to send.

System.Threading.CancellationToken cancellationToken

The System.Threading.CancellationToken to use.

Returns
Response

The Response from the server.

SendRequestAsync(Request, CancellationToken)

Invokes the pipeline asynchronously with the provided request.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public System.Threading.Tasks.ValueTask<Azure.Response> SendRequestAsync (Azure.Core.Request request, System.Threading.CancellationToken cancellationToken);
Parameters
Request request

The Request to send.

System.Threading.CancellationToken cancellationToken

The System.Threading.CancellationToken to use.

Returns
System.Threading.Tasks.ValueTask<Response>

The System.Threading.Tasks.ValueTask representing the asynchronous operation.

Back to top Azure SDK for .NET