Show / Hide Table of Contents

    Class HttpResponseMessageExtensions

    Extensions for HttpResponseMessage class.

    Inheritance
    Object
    HttpResponseMessageExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.Graph.Communications.Common.Transport
    Assembly: Microsoft.Graph.Communications.Common.dll
    Syntax
    public static class HttpResponseMessageExtensions

    Methods

    GetHttpAndContentHeaders(HttpResponseMessage)

    Gets headers from the http response and the content.

    Declaration
    public static IEnumerable<KeyValuePair<string, IEnumerable<string>>> GetHttpAndContentHeaders(this HttpResponseMessage message)
    Parameters
    Type Name Description
    HttpResponseMessage message

    The message.

    Returns
    Type Description
    IEnumerable<KeyValuePair<String, IEnumerable<String>>>

    The list of http and content headers.

    GetOutcomeFromResponseOrException(Nullable<Int32>, Exception)

    Try extracting outcome outcome from HTTP response status code or exception

    Declaration
    public static string GetOutcomeFromResponseOrException(int? statusCode, Exception exception)
    Parameters
    Type Name Description
    Nullable<Int32> statusCode

    HTTP response status code

    Exception exception

    The exception

    Returns
    Type Description
    String

    Outcome string

    ToGraphResponseAsync(HttpResponseMessage)

    Converts HttpResponseMessage to an instance of IGraphResponse<T>.

    Declaration
    public static Task<IGraphResponse> ToGraphResponseAsync(this HttpResponseMessage httpResponse)
    Parameters
    Type Name Description
    HttpResponseMessage httpResponse

    HTTP response to be converted.

    Returns
    Type Description
    Task<IGraphResponse>

    IGraphResponse corresponding to httpResponse.

    ToGraphResponseAsync<T>(HttpResponseMessage, JsonSerializerSettings)

    Converts HttpResponseMessage to an instance of IGraphResponse<T>.

    Declaration
    public static Task<IGraphResponse<T>> ToGraphResponseAsync<T>(this HttpResponseMessage httpResponse, JsonSerializerSettings serializerSettings = null)
    
        where T : class
    Parameters
    Type Name Description
    HttpResponseMessage httpResponse

    HTTP response to be converted.

    Newtonsoft.Json.JsonSerializerSettings serializerSettings

    Add serializer that can serialize the content.

    Returns
    Type Description
    Task<IGraphResponse<T>>

    IGraphResponse<T> corresponding to httpResponse.

    Type Parameters
    Name Description
    T

    Type of the expected response.

    Back to top Copyright (c) Microsoft Corporation. All rights reserved.