Files
csharp/src/KubernetesClient.Basic/Autorest/HttpResponseMessageWrapper.cs
Boshi Lian 8e8619130a netstandard2 extendable lib model, basic rest (#793)
* first lib model

* add missing files

* happy test

* add vanilla rest for extend

* fix new url pattern

* address comments

* add v to tag

* bump ver

* add missing file when ren

* support multi pkg

* fix gh action

* fix env var

* ren title

* use gh action to set ver

* remove unused

* remove unused
2022-03-23 16:25:20 -07:00

47 lines
1.7 KiB
C#

// 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
{
/// <summary>
/// Wrapper around HttpResponseMessage type that copies properties of HttpResponseMessage so that
/// they are available after the HttpClient gets disposed.
/// </summary>
public class HttpResponseMessageWrapper : HttpMessageWrapper
{
/// <summary>
/// Initializes a new instance of the <see cref="HttpResponseMessageWrapper"/> class from HttpResponseMessage.
/// and content.
/// </summary>
#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;
}
/// <summary>
/// Gets or sets the status code of the HTTP response.
/// </summary>
public HttpStatusCode StatusCode { get; protected set; }
/// <summary>
/// Exposes the reason phrase, typically sent along with the status code.
/// </summary>
public string ReasonPhrase { get; protected set; }
}
}