// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Net;
using System.Net.Http;
namespace k8s.Autorest
{
///
/// Wrapper around HttpResponseMessage type that copies properties of HttpResponseMessage so that
/// they are available after the HttpClient gets disposed.
///
public class HttpResponseMessageWrapper : HttpMessageWrapper
{
///
/// Initializes a new instance of the class from HttpResponseMessage.
/// and content.
///
#pragma warning disable SA1611 // Element parameters should be documented
public HttpResponseMessageWrapper(HttpResponseMessage httpResponse, string content)
#pragma warning restore SA1611 // Element parameters should be documented
{
if (httpResponse == null)
{
throw new ArgumentNullException("httpResponse");
}
this.CopyHeaders(httpResponse.Headers);
this.CopyHeaders(httpResponse.GetContentHeaders());
this.Content = content;
this.StatusCode = httpResponse.StatusCode;
this.ReasonPhrase = httpResponse.ReasonPhrase;
}
///
/// Gets or sets the status code of the HTTP response.
///
public HttpStatusCode StatusCode { get; protected set; }
///
/// Exposes the reason phrase, typically sent along with the status code.
///
public string ReasonPhrase { get; protected set; }
}
}