1.73.0 (latest) 1.69.0 1.68.0 1.60.0 1.59.0 1.55.0 1.50.0

    public static class HttpResponseMessageExtensions

Extensions for [HttpResponseMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httpresponsemessage) to help with parasing errors as returned
by some Google services.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> HttpResponseMessageExtensions

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

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

## Assembly

Google.Apis.dll

## Methods

### DeserializeErrorAsync(HttpResponseMessage, string, ISerializer)

    public static Task<RequestError> DeserializeErrorAsync(this HttpResponseMessage response, string name, ISerializer serializer)

Attempts to deserialize a [RequestError](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.RequestError.md.txt) from the `response`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `response` | `HttpResponseMessage` |
| `name` | `string` |
| `serializer` | `ISerializer` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskRequestError` |   |

**Remarks** This method will throw a [GoogleApiException](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.GoogleApiException.md.txt) if:

- The `response` or its [Content](https://learn.microsoft.com/dotnet/api/system.net.http.httpresponsemessage.content) are null.
- Or the deserialization attempt throws a Newtonsoft.Json.JsonException.
- Or the deserilization attempt returns null.

Any exception thrown while reading the `response` [Content](https://learn.microsoft.com/dotnet/api/system.net.http.httpresponsemessage.content) will be bubbled up. Otherwise this method will return the deserialized [RequestError](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.RequestError.md.txt).

<br />