# Interface IHttpExecuteInterceptor (1.73.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.73.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExecuteInterceptor)
- [1.69.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.69.0/Google.Apis.Http.IHttpExecuteInterceptor)
- [1.68.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Http.IHttpExecuteInterceptor)
- [1.60.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Http.IHttpExecuteInterceptor)
- [1.59.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Http.IHttpExecuteInterceptor)
- [1.55.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Http.IHttpExecuteInterceptor)
- [1.50.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Http.IHttpExecuteInterceptor)

    public interface IHttpExecuteInterceptor

HTTP request execute interceptor to intercept a [HttpRequestMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage) before it has
been sent. Sample usage is attaching "Authorization" header to a request.

## Namespace

[Google.Apis.Http](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http)

## Assembly

Google.Apis.Core.dll

## Methods

### InterceptAsync(HttpRequestMessage, CancellationToken)

    Task InterceptAsync(HttpRequestMessage request, CancellationToken cancellationToken)

Invoked before the request is being sent.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage` The HTTP request message. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` Cancellation token to cancel the operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` |   |

## Extension Methods

[HttpExtenstions.ToDelegatingHandler(IHttpExecuteInterceptor)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpExtenstions#Google_Apis_Http_HttpExtenstions_ToDelegatingHandler_Google_Apis_Http_IHttpExecuteInterceptor_) [HttpExtenstions.ToDelegatingHandler(IHttpExecuteInterceptor, HttpMessageHandler)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpExtenstions#Google_Apis_Http_HttpExtenstions_ToDelegatingHandler_Google_Apis_Http_IHttpExecuteInterceptor_System_Net_Http_HttpMessageHandler_) [Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)