Class HttpMessagesExtensions
public static class HttpMessagesExtensions
- Inheritance
-
HttpMessagesExtensions
- Inherited Members
Methods
GetBody(HttpRequestMessage)
Gets the body content as a string from the specified request
.
public static string GetBody(this HttpRequestMessage request)
Parameters
request
HttpRequestMessageThe HTTP request message to extract the body content from.
Returns
GetBody(HttpResponseMessage)
Gets the body content as a string from the specified response
.
public static string GetBody(this HttpResponseMessage response)
Parameters
response
HttpResponseMessageThe HTTP response message to extract the body content from.
Returns
GetBodyAsExpando(HttpRequestMessage)
Gets the body content as a CaseInsensitiveExpandoObject from the specified request
.
This is possible only if the body content is in JSON structure.
public static CaseInsensitiveExpandoObject GetBodyAsExpando(this HttpRequestMessage request)
Parameters
request
HttpRequestMessageThe HTTP request message to extract the body content from.
Returns
- CaseInsensitiveExpandoObject
The body content as a CaseInsensitiveExpandoObject.
GetBodyAsExpando(HttpResponseMessage)
Gets the body content as a CaseInsensitiveExpandoObject from the specified response
.
This is possible only if the body content is in JSON structure.
public static CaseInsensitiveExpandoObject GetBodyAsExpando(this HttpResponseMessage response)
Parameters
response
HttpResponseMessageThe HTTP response message to extract the body content from.
Returns
- CaseInsensitiveExpandoObject
The body content as a CaseInsensitiveExpandoObject.
GetBodyAsExpandoAsync(HttpRequestMessage)
Asynchronously gets the body content as a CaseInsensitiveExpandoObject
from the specified request
. This is possible only if the body content is in JSON structure.
public static Task<CaseInsensitiveExpandoObject> GetBodyAsExpandoAsync(this HttpRequestMessage request)
Parameters
request
HttpRequestMessageThe HTTP request message to extract the body content from.
Returns
- Task<CaseInsensitiveExpandoObject>
A Task that represents the asynchronous operation. The result is the body content as a CaseInsensitiveExpandoObject.
GetBodyAsExpandoAsync(HttpResponseMessage)
Asynchronously gets the body content as a CaseInsensitiveExpandoObject
from the specified response
. This is possible only if the body content is in JSON structure.
public static Task<CaseInsensitiveExpandoObject> GetBodyAsExpandoAsync(this HttpResponseMessage response)
Parameters
response
HttpResponseMessageThe HTTP response message to extract the body content from.
Returns
- Task<CaseInsensitiveExpandoObject>
A Task that represents the asynchronous operation. The result is the body content as a CaseInsensitiveExpandoObject.
GetBodyAsync(HttpRequestMessage)
Asynchronously gets the body content as a string from the specified request
.
public static Task<string> GetBodyAsync(this HttpRequestMessage request)
Parameters
request
HttpRequestMessageThe HTTP request message to extract the body content from.
Returns
- Task<string>
A Task that represents the asynchronous operation. The result is the body content as a string. Returns an empty string if the content is null.
GetBodyAsync(HttpResponseMessage)
Asynchronously gets the body content as a string from the specified response
.
public static Task<string> GetBodyAsync(this HttpResponseMessage response)
Parameters
response
HttpResponseMessageThe HTTP response message to extract the body content from.
Returns
- Task<string>
A Task that represents the asynchronous operation. The result is the body content as a string. Returns an empty string if the content is null.
GetBodyAsync<TResult>(HttpRequestMessage)
Asynchronously gets the body content as a TResult
from the specified request
.
This is possible only if the body content is in JSON structure.
public static Task<TResult?> GetBodyAsync<TResult>(this HttpRequestMessage request)
Parameters
request
HttpRequestMessageThe HTTP request message to extract the body content from.
Returns
- Task<TResult>
A Task that represents the asynchronous operation. The result is the body content as a
TResult
.
Type Parameters
TResult
Type which JSON body content will be deserialized to.
GetBodyAsync<TResult>(HttpResponseMessage)
Asynchronously gets the body content as a TResult
from the specified response
.
This is possible only if the body content is in JSON structure.
public static Task<TResult?> GetBodyAsync<TResult>(this HttpResponseMessage response)
Parameters
response
HttpResponseMessageThe HTTP response message to extract the body content from.
Returns
- Task<TResult>
A Task that represents the asynchronous operation. The result is the body content as a
TResult
.
Type Parameters
TResult
Type which JSON body content will be deserialized to.
GetBody<TResult>(HttpRequestMessage)
Gets the body content as a TResult
from the specified request
.
This is possible only if the body content is in JSON structure.
public static TResult? GetBody<TResult>(this HttpRequestMessage request)
Parameters
request
HttpRequestMessageThe HTTP request message to extract the body content from.
Returns
- TResult
The body content as a
TResult
.
Type Parameters
TResult
Type which JSON body content will be deserialized to.
GetBody<TResult>(HttpResponseMessage)
Gets the body content as a TResult
from the specified response
.
This is possible only if the body content is in JSON structure.
public static TResult? GetBody<TResult>(this HttpResponseMessage response)
Parameters
response
HttpResponseMessageThe HTTP response message to extract the body content from.
Returns
- TResult
The body content as a
TResult
.
Type Parameters
TResult
Type which JSON body content will be deserialized to.
StatusCode(HttpResponseMessage)
Gets the status code as an int from the specified response
.
public static int StatusCode(this HttpResponseMessage response)
Parameters
response
HttpResponseMessageThe HTTP response to extract the status code from.