Skip to main content

Definition

Assembly: System.Net.Http.dll Namespace: System.Net.Http

Syntax

System.Net.Http.HttpResponseMessage

Summary

This type is defined in System.Net.Http.

Remarks

See Microsoft documentation for more information about the rest of the API.

Methods

DeserializeResponseAsync Extension

Extension method from System.Net.Http.EasyAF_Http_NewtonsoftJson_HttpResponseMessageExtensions
Deserializes the HTTP response message content to the specified type using Newtonsoft.Json with default settings. Returns either the deserialized response or error content as a string.

Syntax

public static System.Threading.Tasks.Task<(T, string)> DeserializeResponseAsync<T>(System.Net.Http.HttpResponseMessage message)

Parameters

NameTypeDescription
messageSystem.Net.Http.HttpResponseMessageThe HTTP response message to deserialize.

Returns

Type: System.Threading.Tasks.Task<(T, string)> A tuple containing either the deserialized response object or error content string.

Type Parameters

  • T - The type to deserialize the response content to.

DeserializeResponseAsync Extension

Extension method from System.Net.Http.EasyAF_Http_NewtonsoftJson_HttpResponseMessageExtensions
Deserializes the HTTP response message content to the specified type using Newtonsoft.Json with custom settings. Automatically configures SystemTextJsonContractResolver if not already set. Returns either the deserialized response or error content as a string.

Syntax

public static System.Threading.Tasks.Task<(T, string)> DeserializeResponseAsync<T>(System.Net.Http.HttpResponseMessage message, Newtonsoft.Json.JsonSerializerSettings settings)

Parameters

NameTypeDescription
messageSystem.Net.Http.HttpResponseMessageThe HTTP response message to deserialize.
settingsNewtonsoft.Json.JsonSerializerSettingsThe JSON serializer settings to use for deserialization.

Returns

Type: System.Threading.Tasks.Task<(T, string)> A tuple containing either the deserialized response object or error content string.

Type Parameters

  • T - The type to deserialize the response content to.

DeserializeResponseAsync Extension

Extension method from System.Net.Http.EasyAF_Http_NewtonsoftJson_HttpResponseMessageExtensions
Deserializes the HTTP response message content to strongly-typed response and error objects using Newtonsoft.Json with default settings. Provides type-safe error handling by deserializing error responses to a specific error type.

Syntax

public static System.Threading.Tasks.Task<(TResponse, TError)> DeserializeResponseAsync<TResponse, TError>(System.Net.Http.HttpResponseMessage message)

Parameters

NameTypeDescription
messageSystem.Net.Http.HttpResponseMessageThe HTTP response message to deserialize.

Returns

Type: System.Threading.Tasks.Task<(TResponse, TError)> A tuple containing either the deserialized response object or deserialized error object.

Type Parameters

  • TResponse - The type to deserialize successful response content to.
  • TError - The type to deserialize error response content to.

DeserializeResponseAsync Extension

Extension method from System.Net.Http.EasyAF_Http_NewtonsoftJson_HttpResponseMessageExtensions
Deserializes the HTTP response message content to strongly-typed response and error objects using Newtonsoft.Json with custom settings. Automatically configures SystemTextJsonContractResolver if not already set. Provides type-safe error handling by deserializing error responses to a specific error type.

Syntax

public static System.Threading.Tasks.Task<(TResponse, TError)> DeserializeResponseAsync<TResponse, TError>(System.Net.Http.HttpResponseMessage message, Newtonsoft.Json.JsonSerializerSettings settings)

Parameters

NameTypeDescription
messageSystem.Net.Http.HttpResponseMessageThe HTTP response message to deserialize.
settingsNewtonsoft.Json.JsonSerializerSettingsThe JSON serializer settings to use for deserialization.

Returns

Type: System.Threading.Tasks.Task<(TResponse, TError)> A tuple containing either the deserialized response object or deserialized error object.

Type Parameters

  • TResponse - The type to deserialize successful response content to.
  • TError - The type to deserialize error response content to.

DeserializeResponseAsync Extension

Extension method from System.Net.Http.EasyAF_Http_SystemTextJson_HttpResponseMessageExtensions
Deserializes the HTTP response message content to the specified type using System.Text.Json with default options. Returns either the deserialized response or error content as a string.

Syntax

public static System.Threading.Tasks.Task<(T, string)> DeserializeResponseAsync<T>(System.Net.Http.HttpResponseMessage message)

Parameters

NameTypeDescription
messageSystem.Net.Http.HttpResponseMessageThe HTTP response message to deserialize.

Returns

Type: System.Threading.Tasks.Task<(T, string)> A tuple containing either the deserialized response object or error content string.

Type Parameters

  • T - The type to deserialize the response content to.

DeserializeResponseAsync Extension

Extension method from System.Net.Http.EasyAF_Http_SystemTextJson_HttpResponseMessageExtensions
Deserializes the HTTP response message content to the specified type using System.Text.Json with custom options. Returns either the deserialized response or error content as a string.

Syntax

public static System.Threading.Tasks.Task<(T, string)> DeserializeResponseAsync<T>(System.Net.Http.HttpResponseMessage message, System.Text.Json.JsonSerializerOptions settings)

Parameters

NameTypeDescription
messageSystem.Net.Http.HttpResponseMessageThe HTTP response message to deserialize.
settingsSystem.Text.Json.JsonSerializerOptionsThe JSON serializer options to use for deserialization.

Returns

Type: System.Threading.Tasks.Task<(T, string)> A tuple containing either the deserialized response object or error content string.

Type Parameters

  • T - The type to deserialize the response content to.

DeserializeResponseAsync Extension

Extension method from System.Net.Http.EasyAF_Http_SystemTextJson_HttpResponseMessageExtensions
Deserializes the HTTP response message content to strongly-typed response and error objects using System.Text.Json with default options. Provides type-safe error handling by deserializing error responses to a specific error type.

Syntax

public static System.Threading.Tasks.Task<(TResponse, TError)> DeserializeResponseAsync<TResponse, TError>(System.Net.Http.HttpResponseMessage message)

Parameters

NameTypeDescription
messageSystem.Net.Http.HttpResponseMessageThe HTTP response message to deserialize.

Returns

Type: System.Threading.Tasks.Task<(TResponse, TError)> A tuple containing either the deserialized response object or deserialized error object.

Type Parameters

  • TResponse - The type to deserialize successful response content to.
  • TError - The type to deserialize error response content to.

DeserializeResponseAsync Extension

Extension method from System.Net.Http.EasyAF_Http_SystemTextJson_HttpResponseMessageExtensions
Deserializes the HTTP response message content to strongly-typed response and error objects using System.Text.Json with custom options. Provides type-safe error handling by deserializing error responses to a specific error type.

Syntax

public static System.Threading.Tasks.Task<(TResponse, TError)> DeserializeResponseAsync<TResponse, TError>(System.Net.Http.HttpResponseMessage message, System.Text.Json.JsonSerializerOptions settings)

Parameters

NameTypeDescription
messageSystem.Net.Http.HttpResponseMessageThe HTTP response message to deserialize.
settingsSystem.Text.Json.JsonSerializerOptionsThe JSON serializer options to use for deserialization.

Returns

Type: System.Threading.Tasks.Task<(TResponse, TError)> A tuple containing either the deserialized response object or deserialized error object.

Type Parameters

  • TResponse - The type to deserialize successful response content to.
  • TError - The type to deserialize error response content to.