Class HttpRequestMessageExtensions
Extensions for HttpRequestMessage.
Inherited Members
Namespace: Microsoft.Graph.Communications.Common.Transport
Assembly: Microsoft.Graph.Communications.Common.dll
Syntax
public static class HttpRequestMessageExtensions
Methods
Add(HttpHeaders, IGraphProperty)
Adds the header.
Declaration
public static void Add(this HttpHeaders headers, IGraphProperty property)
Parameters
Type | Name | Description |
---|---|---|
HttpHeaders | headers | The headers. |
IGraphProperty | property | The property. |
CloneHttpRequestMessageAsync(HttpRequestMessage)
Clones the HTTP request message.
Declaration
public static Task<HttpRequestMessage> CloneHttpRequestMessageAsync(this HttpRequestMessage req)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | req | The req. |
Returns
Type | Description |
---|---|
Task<HttpRequestMessage> | Cloned request message |
GetHttpAndContentHeaders(HttpRequestMessage)
Gets headers from the http request and the content.
Declaration
public static IEnumerable<KeyValuePair<string, IEnumerable<string>>> GetHttpAndContentHeaders(this HttpRequestMessage message)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | message | The message. |
Returns
Type | Description |
---|---|
IEnumerable<KeyValuePair<String, IEnumerable<String>>> | The list of http and content headers. |
ToGraphRequestAsync(HttpRequestMessage)
Converts a HttpRequestMessage into a IGraphRequest.
Declaration
public static Task<IGraphRequest> ToGraphRequestAsync(this HttpRequestMessage httpRequest)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | httpRequest | HttpRequestMessage to be converted. |
Returns
Type | Description |
---|---|
Task<IGraphRequest> | IGraphRequest object corresponding to |
ToGraphRequestAsync<T>(HttpRequestMessage, JsonSerializerSettings)
Converts a HttpRequestMessage into a IGraphRequest<T>.
Declaration
public static Task<IGraphRequest<T>> ToGraphRequestAsync<T>(this HttpRequestMessage httpRequest, JsonSerializerSettings serializerSettings = null)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | httpRequest | HttpRequestMessage to be converted. |
Newtonsoft.Json.JsonSerializerSettings | serializerSettings | Json serializer settings. |
Returns
Type | Description |
---|---|
Task<IGraphRequest<T>> | IGraphRequest<T> object corresponding to |
Type Parameters
Name | Description |
---|---|
T | Type of the content present in |
ToRequestType(HttpMethod)
Convert HttpMethod to the type of the request.
Declaration
public static RequestType ToRequestType(this HttpMethod httpMethod)
Parameters
Type | Name | Description |
---|---|---|
HttpMethod | httpMethod | The HTTP method. |
Returns
Type | Description |
---|---|
RequestType | RequestType corresponding to the httpMethod |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if httpMethod has no corresponding RequestType |