Class RequestOptions
Options that can be used to control the behavior of a request sent by a client.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: System.ClientModel.dll
Syntax
[System.Runtime.CompilerServices.Nullable(0)]
[System.Runtime.CompilerServices.NullableContext(1)]
public class RequestOptions
Constructors
RequestOptions()
Properties
BufferResponse
Gets or sets a value indicating whether the response content should be
buffered in-memory by the pipeline. This value defaults to true
.
Declaration
public bool BufferResponse { get; set; }
Property Value
System.Boolean
|
Remarks
Please note that setting this value to false
will result
in the ContentStream obtained from
GetRawResponse() holding a live network stream.
It is the responsibility of the caller to ensure the stream is disposed.
CancellationToken
Gets or sets the CancellationToken used for the duration of the call to Send(PipelineMessage).
Declaration
public System.Threading.CancellationToken CancellationToken { get; set; }
Property Value
System.Threading.CancellationToken
|
ErrorOptions
Gets or sets a value that describes when a client's service method will raise an exception if the underlying response is considered an error.
Declaration
public System.ClientModel.Primitives.ClientErrorBehaviors ErrorOptions { get; set; }
Property Value
ClientErrorBehaviors
|
Methods
AddHeader(String, String)
Adds the specified header and its value to the request's header collection. If a header with this name is already present in the collection, the value will be added to the comma-separated list of values associated with the header.
Declaration
public void AddHeader (string name, string value);
Parameters
System.String
name
The name of the header to add. |
System.String
value
The value of the header. |
AddPolicy(PipelinePolicy, PipelinePosition)
Adds a PipelinePolicy into the pipeline for the duration of this request.
Declaration
public void AddPolicy (System.ClientModel.Primitives.PipelinePolicy policy, System.ClientModel.Primitives.PipelinePosition position);
Parameters
PipelinePolicy
policy
The PipelinePolicy to add to the pipeline. |
PipelinePosition
position
The position of the policy in the pipeline. |
Exceptions
System.ArgumentException
Thrown when the provided policy
is |
Apply(PipelineMessage)
Apply the options provided in this RequestOptions
instance to the message
.
Declaration
protected internal virtual void Apply (System.ClientModel.Primitives.PipelineMessage message);
Parameters
PipelineMessage
message
The PipelineMessage to apply the options to. |
AssertNotFrozen()
Assert that Freeze() has not been called on this RequestOptions instance.
Declaration
protected void AssertNotFrozen ();
Exceptions
System.InvalidOperationException
Thrown when an attempt is made to change the state of this RequestOptions instance after Freeze() has been called. |
Freeze()
Freeze this instance of RequestOptions. After this method has been called, any attempt to set properties on the instance or call methods that would change its state will throw System.InvalidOperationException.
Declaration
public virtual void Freeze ();
SetHeader(String, String)
Sets the specified header and its value in the request's header collection. If a header with this name is already present in the collection, the header's value will be replaced with the specified value.
Declaration
public void SetHeader (string name, string value);
Parameters
System.String
name
The name of the header to set. |
System.String
value
The value of the header. |