A message handler which contains the main logic of our HTTP requests. It contains a list ofIHttpUnsuccessfulResponseHandlers for handling abnormal responses, a list ofIHttpExceptionHandlers for handling exception in a request and a list ofIHttpExecuteInterceptors for intercepting a request before it has been sent to the server.
It also contains important properties like number of tries, follow redirect, etc.
Represents the already configuredHttpMessageHandlerto be used
when building aConfigurableHttpClientby the factory and
information about the actual configuration.
HTTP request execute interceptor to intercept aHttpRequestMessagebefore it has
been sent. Sample usage is attaching "Authorization" header to a request.
A delegate used to intercept stream data without modifying it.
The parameters should always be validated before the delegate is called,
so the delegate itself does not need to validate them again.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis documentation covers the \u003ccode\u003eGoogle.Apis.Http\u003c/code\u003e namespace, offering various classes, interfaces, enums, and delegates for managing HTTP requests and responses within the Google APIs .NET library.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eConfigurableHttpClient\u003c/code\u003e and \u003ccode\u003eConfigurableMessageHandler\u003c/code\u003e classes provide a robust framework for customizing HTTP client behavior, including the handling of exceptions, intercepting requests, and managing unsuccessful responses.\u003c/p\u003e\n"],["\u003cp\u003eKey components include \u003ccode\u003eIHttpUnsuccessfulResponseHandler\u003c/code\u003e, \u003ccode\u003eIHttpExceptionHandler\u003c/code\u003e, and \u003ccode\u003eIHttpExecuteInterceptor\u003c/code\u003e which allow for the handling of abnormal responses, exceptions, and the interception of requests before they are sent, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eHttpClientFactory\u003c/code\u003e and \u003ccode\u003eHttpClientFromMessageHandlerFactory\u003c/code\u003e provide different implementations of \u003ccode\u003eIHttpClientFactory\u003c/code\u003e for creating HTTP clients, with the latter offering the capability to inject inner message handlers.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eExponentialBackOffPolicy\u003c/code\u003e and \u003ccode\u003eBackOffHandler\u003c/code\u003e classes manage retries with exponential backoff, and the \u003ccode\u003eMaxUrlLengthInterceptor\u003c/code\u003e changes GET requests to POST requests when URLs exceed a certain length.\u003c/p\u003e\n"]]],[],null,["# Namespace Google.Apis.Http (1.69.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.69.0 (latest)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http)\n- [1.68.0](/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Http)\n- [1.60.0](/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Http)\n- [1.59.0](/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Http)\n- [1.55.0](/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Http)\n- [1.50.0](/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Http) \n\nClasses\n-------\n\n### [BackOffHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.BackOffHandler)\n\nA thread-safe back-off handler which handles an abnormal HTTP response or an exception with\n[IBackOff](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.IBackOff).\n\n### [BackOffHandler.Initializer](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.BackOffHandler.Initializer)\n\nAn initializer class to initialize a back-off handler.\n\n### [ConfigurableHttpClient](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableHttpClient)\n\nConfigurable HTTP client inherits from [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient) and contains a reference to\n[ConfigurableMessageHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableMessageHandler).\n\n### [ConfigurableMessageHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableMessageHandler)\n\nA message handler which contains the main logic of our HTTP requests. It contains a list of\n[IHttpUnsuccessfulResponseHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpUnsuccessfulResponseHandler)s for handling abnormal responses, a list of\n[IHttpExceptionHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExceptionHandler)s for handling exception in a request and a list of\n[IHttpExecuteInterceptor](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExecuteInterceptor)s for intercepting a request before it has been sent to the server.\nIt also contains important properties like number of tries, follow redirect, etc.\n\n### [CreateHttpClientArgs](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.CreateHttpClientArgs)\n\nArguments for creating a HTTP client.\n\n### [ExponentialBackOffInitializer](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ExponentialBackOffInitializer)\n\nAn initializer which adds exponential back-off as exception handler and \\\\ or unsuccessful response handler by\nthe given [ExponentialBackOffPolicy](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ExponentialBackOffPolicy).\n\n### [HandleExceptionArgs](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HandleExceptionArgs)\n\nArgument class to [HandleExceptionAsync(HandleExceptionArgs)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExceptionHandler#Google_Apis_Http_IHttpExceptionHandler_HandleExceptionAsync_Google_Apis_Http_HandleExceptionArgs_).\n\n### [HandleUnsuccessfulResponseArgs](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HandleUnsuccessfulResponseArgs)\n\nArgument class to [HandleResponseAsync(HandleUnsuccessfulResponseArgs)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpUnsuccessfulResponseHandler#Google_Apis_Http_IHttpUnsuccessfulResponseHandler_HandleResponseAsync_Google_Apis_Http_HandleUnsuccessfulResponseArgs_).\n\n### [HttpClientFactory](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpClientFactory)\n\nThe default implementation of the HTTP client factory.\n\n### [HttpClientFromMessageHandlerFactory](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpClientFromMessageHandlerFactory)\n\nAn implementation of [IHttpClientFactory](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpClientFactory) that allows\nfor the inner message handler to be injected.\n\n### [HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler)\n\nRepresents the already configured [HttpMessageHandler](https://learn.microsoft.com/dotnet/api/system.net.http.httpmessagehandler) to be used\nwhen building a [ConfigurableHttpClient](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableHttpClient) by the factory and\ninformation about the actual configuration.\n\n### [HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions)\n\nSpecifies the configuration options for a message handler.\n\n### [HttpConsts](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpConsts)\n\nHTTP constants.\n\n### [HttpExtenstions](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpExtenstions)\n\nExtension methods to [HttpRequestMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage) and\n[HttpResponseMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httpresponsemessage).\n\n### [MaxUrlLengthInterceptor](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.MaxUrlLengthInterceptor)\n\nIntercepts HTTP GET requests with a URLs longer than a specified maximum number of characters.\nThe interceptor will change such requests as follows:\n\n- The request's method will be changed to POST\n- A `X-HTTP-Method-Override` header will be added with the value `GET`\n- Any query parameters from the URI will be moved into the body of the request.\n- If query parameters are moved, the content type is set to `application/x-www-form-urlencoded`\n\n\u003cbr /\u003e\n\nInterfaces\n----------\n\n### [IConfigurableHttpClientInitializer](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IConfigurableHttpClientInitializer)\n\nHTTP client initializer for changing the default behavior of HTTP client.\nUse this initializer to change default values like timeout and number of tries.\nYou can also set different handlers and interceptors like [IHttpUnsuccessfulResponseHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpUnsuccessfulResponseHandler)s,\n[IHttpExceptionHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExceptionHandler)s and [IHttpExecuteInterceptor](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExecuteInterceptor)s.\n\n### [IHttpClientFactory](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpClientFactory)\n\nHTTP client factory creates configurable HTTP clients. A unique HTTP client should be created for each service.\n\n### [IHttpExceptionHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExceptionHandler)\n\nException handler is invoked when an exception is thrown during a HTTP request.\n\n### [IHttpExecuteInterceptor](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExecuteInterceptor)\n\nHTTP request execute interceptor to intercept a [HttpRequestMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage) before it has\nbeen sent. Sample usage is attaching \"Authorization\" header to a request.\n\n### [IHttpUnsuccessfulResponseHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpUnsuccessfulResponseHandler)\n\nUnsuccessful response handler which is invoked when an abnormal HTTP response is returned when sending a HTTP\nrequest.\n\nEnums\n-----\n\n### [ConfigurableMessageHandler.LogEventType](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableMessageHandler.LogEventType)\n\nSpecifies the type(s) of request/response events to log.\n\n### [ExponentialBackOffPolicy](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ExponentialBackOffPolicy)\n\nIndicates which of exceptions and / or HTTP status codes are automatically retried using exponential backoff.\n\nDelegates\n---------\n\n### [StreamInterceptor](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.StreamInterceptor)\n\nA delegate used to intercept stream data without modifying it.\nThe parameters should always be validated before the delegate is called,\nso the delegate itself does not need to validate them again."]]