다음을 통해 공유


RequestContext Class

Definition

Options that can be used to control the behavior of a request sent by a client.

public class RequestContext
type RequestContext = class
Public Class RequestContext
Inheritance
RequestContext

Constructors

RequestContext()

Initializes a new instance of the RequestContext class.

Properties

CancellationToken

The token to check for cancellation.

ErrorOptions

Controls under what conditions the operation raises an exception if the underlying response indicates a failure.

Methods

AddClassifier(Int32, Boolean)

Customizes the ResponseClassifier for this operation to change the default Response classification behavior so that it considers the passed-in status code to be an error or not, as specified. Status code classifiers are applied after all ResponseClassificationHandler classifiers. This is useful for cases where you'd like to prevent specific response status codes from being treated as errors by logging and distributed tracing policies -- that is, if a response is not classified as an error, it will not appear as an error in logs or distributed traces.

AddClassifier(ResponseClassificationHandler)

Customizes the ResponseClassifier for this operation. Adding a ResponseClassificationHandler changes the classification behavior so that it first tries to classify a response via the handler, and if the handler doesn't have an opinion, it instead uses the default classifier. Handlers are applied in order so the most recently added takes precedence. This is useful for cases where you'd like to prevent specific response status codes from being treated as errors by logging and distributed tracing policies -- that is, if a response is not classified as an error, it will not appear as an error in logs or distributed traces.

AddPolicy(HttpPipelinePolicy, HttpPipelinePosition)

Adds an HttpPipelinePolicy into the pipeline for the duration of this request. The position of policy in the pipeline is controlled by position parameter. If you want the policy to execute once per client request use PerCall otherwise use PerRetry to run the policy for every retry.

Operators

Implicit(ErrorOptions to RequestContext)

Initializes a new instance of the RequestContext class using the given ErrorOptions.

Applies to