Class PipelineResponse
Represents an HTTP response received from a cloud service.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: System.ClientModel.dll
Syntax
[System.Runtime.CompilerServices.Nullable(0)]
[System.Runtime.CompilerServices.NullableContext(1)]
public abstract class PipelineResponse : IDisposable
Constructors
PipelineResponse()
Declaration
protected PipelineResponse ();
Properties
Content
Gets the contents of the HTTP response.
Declaration
public abstract BinaryData Content { get; }
Property Value
System.BinaryData
|
Remarks
Content holds the in-memory contents of the HTTP response
when BufferResponse is true
on
the message sent via Send(PipelineMessage).
If this PipelineResponse instance was obtained from the
return value of a client's service method, please refer to the
documentation for the service method to understand whether this property
can be accessed without throwing an exception. If this instance is
accessed from a PipelinePolicy, please check the value of
BufferResponse to determine whether to
obtain the response content from Content or
ContentStream.
Exceptions
System.InvalidOperationException
Thrown if the response is not buffered. |
ContentStream
Gets or sets the contents of the HTTP response.
Declaration
[System.Runtime.CompilerServices.Nullable(2)]
[get: System.Runtime.CompilerServices.NullableContext(2)]
[set: System.Runtime.CompilerServices.NullableContext(2)]
public abstract System.IO.Stream ContentStream { get; set; }
Property Value
System.IO.Stream
|
Remarks
ContentStream may be a stream that contains the buffered contents transferred from the network stream that originally held the contents of the service response; or it may be the live network stream itself, depending on the value of BufferResponse on the message sent via Send(PipelineMessage). Please refer to the documentation for a client's service method if needed to understand whether this PipelineResponse instance must be disposed to close the network stream.
Headers
Gets the collection of HTTP response headers.
Declaration
public System.ClientModel.Primitives.PipelineResponseHeaders Headers { get; }
Property Value
PipelineResponseHeaders
|
HeadersCore
Gets or sets the derived-type's value of the response's Headers collection.
Declaration
protected abstract System.ClientModel.Primitives.PipelineResponseHeaders HeadersCore { get; }
Property Value
PipelineResponseHeaders
|
IsError
Indicates whether the status code of the returned response is considered an error code.
Declaration
public virtual bool IsError { get; }
Property Value
System.Boolean
|
IsErrorCore
Gets or sets the derived-type's value of IsError.
Declaration
protected internal virtual bool IsErrorCore { get; set; }
Property Value
System.Boolean
|
ReasonPhrase
Gets the reason phrase that accompanies the status code on the HTTP response.
Declaration
public abstract string ReasonPhrase { get; }
Property Value
System.String
|
Status
Gets the status code of the HTTP response.
Declaration
public abstract int Status { get; }
Property Value
System.Int32
|
Methods
BufferContent(CancellationToken)
Transfer the contents of the response network stream from ContentStream to a buffered cache on this PipelineResponse instance.
Declaration
public abstract BinaryData BufferContent (System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken to use while buffering the content. |
Returns
System.BinaryData
The buffered content. |
Remarks
This method will read the full content from the response content
network stream into memory. Please be sure the contents will fit into
memory before calling this method.
BufferContentAsync(CancellationToken)
Transfer the contents of the response network stream from ContentStream to a buffered cache on this PipelineResponse instance.
Declaration
public abstract System.Threading.Tasks.ValueTask<BinaryData> BufferContentAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken to use while buffering the content. |
Returns
System.Threading.Tasks.ValueTask<System.BinaryData>
The buffered content. |
Remarks
This method will read the full content from the response content
network stream into memory. Please be sure the contents will fit into
memory before calling this method.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public abstract void Dispose ();