docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ServiceHttpClientHeaderModifier

    An implementation of an HTTP client which abstracts the Task of sending HttpRequestMessage and adds a fixed set of predefined headers to each request.

    Inheritance
    object
    ServiceHttpClientHeaderModifier
    Implements
    IServiceHttpClient
    IHttpClient
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Cloud.Common
    Assembly: Unity.Cloud.Common.dll
    Syntax
    public class ServiceHttpClientHeaderModifier : IServiceHttpClient, IHttpClient

    Constructors

    ServiceHttpClientHeaderModifier(IServiceHttpClient, Dictionary<string, string>, string)

    Creates and instance of ServiceHttpClientHeaderModifier.

    Declaration
    public ServiceHttpClientHeaderModifier(IServiceHttpClient serviceHttpClient, Dictionary<string, string> headers, string urlFilter = null)
    Parameters
    Type Name Description
    IServiceHttpClient serviceHttpClient

    The client who's requests will have headers added.

    Dictionary<string, string> headers

    The headers to add to each request.

    string urlFilter

    The optional url filter to determine which requests should have the headers added. A null or empty filter will add the headers to all requests.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if serviceHttpClient or any key in headers is null.

    Properties

    Timeout

    The timespan to wait before the request times out.

    Declaration
    public TimeSpan Timeout { get; set; }
    Property Value
    Type Description
    TimeSpan

    Methods

    SendAsync(HttpRequestMessage, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)

    Sends an asynchronous HTTP request.

    Declaration
    public Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    HttpRequestMessage request

    The request to be sent.

    HttpCompletionOption completionOption

    When the operation should complete.

    IProgress<HttpProgress> progress

    The progress provider.

    CancellationToken cancellationToken

    Cancellation token that will try to cancel the operation.

    Returns
    Type Description
    Task<HttpResponseMessage>

    A task that will hold the HttpResponseMessage once the request is completed

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when the request is null.

    HttpRequestException

    Thrown when an HTTP response can't be obtained from the server.

    OperationCanceledException

    Thrown when the request is cancelled by a cancellation token or due to timeout.

    SendAsync(HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)

    Send an asynchronous HTTP request.

    Declaration
    public Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpRequestMessage request

    The request to be sent.

    ServiceHttpClientOptions options

    The options for the client.

    HttpCompletionOption completionOption

    When the operation should complete.

    IProgress<HttpProgress> progress

    The progress provider.

    CancellationToken cancellationToken

    Optional cancellation token that will try to cancel the operation.

    Returns
    Type Description
    Task<HttpResponseMessage>

    A task that will hold the HttpResponseMessage once the request is completed

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when the request is null.

    HttpRequestException

    Thrown when an HTTP response can't be obtained from the server.

    OperationCanceledException

    Thrown when the request is cancelled by a cancellation token.

    TimeoutException

    Thrown when the request failed due to timeout.

    Implements

    IServiceHttpClient
    IHttpClient

    Extension Methods

    HttpClientExtensions.DeleteAsync(IHttpClient, string, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.DeleteAsync(IHttpClient, string, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.DeleteAsync(IHttpClient, Uri, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.DeleteAsync(IHttpClient, Uri, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.GetAsync(IHttpClient, string, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.GetAsync(IHttpClient, Uri, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PatchAsync(IHttpClient, string, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PatchAsync(IHttpClient, Uri, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PostAsync(IHttpClient, string, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PostAsync(IHttpClient, Uri, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PutAsync(IHttpClient, string, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PutAsync(IHttpClient, Uri, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.SendAsync(IHttpClient, HttpRequestMessage)
    HttpClientExtensions.SendAsync(IHttpClient, HttpRequestMessage, HttpCompletionOption)
    HttpClientExtensions.SendAsync(IHttpClient, HttpRequestMessage, HttpCompletionOption, CancellationToken)
    HttpClientExtensions.SendAsync(IHttpClient, HttpRequestMessage, CancellationToken)
    HttpClientJsonExtensions.DeleteJsonAsync(IHttpClient, string, object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.DeleteJsonAsync<TModel>(IHttpClient, string, object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.GetJsonAsync<TModel>(IHttpClient, string, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.PatchJsonAsync<TModel>(IHttpClient, string, object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.PostJsonAsync<TModel>(IHttpClient, string, object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.PutJsonAsync<TModel>(IHttpClient, string, object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, string, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, string, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, string, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, string, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, string, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, string, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, string, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption)
    ServiceHttpClientExtensions.SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption, CancellationToken)
    ServiceHttpClientExtensions.SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.WithApiSourceHeaders(IServiceHttpClient, string, string)
    ServiceHttpClientExtensions.WithApiSourceHeadersFromAssembly(IServiceHttpClient, Assembly)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)