本文整理汇总了C#中System.Net.Http.HttpResponseMessage.GetContentHeaders方法的典型用法代码示例。如果您正苦于以下问题:C# HttpResponseMessage.GetContentHeaders方法的具体用法?C# HttpResponseMessage.GetContentHeaders怎么用?C# HttpResponseMessage.GetContentHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Http.HttpResponseMessage
的用法示例。
在下文中一共展示了HttpResponseMessage.GetContentHeaders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HttpResponseMessageWrapper
/// <summary>
/// Initializes a new instance of the HttpResponseMessageWrapper class from HttpResponseMessage
/// and content.
/// </summary>
public HttpResponseMessageWrapper(HttpResponseMessage httpResponse, string content)
{
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;
}
示例2: Create
/// <summary>
/// Creates a new CloudHttpResponseErrorInfo from a HttpResponseMessage.
/// </summary>
/// <param name="response">The resposne message.</param>
/// <param name="content">
/// The response content, which may be passed separately if the
/// response has already been disposed.
/// </param>
/// <returns>A CloudHttpResponseErrorInfo instance.</returns>
public static CloudHttpResponseErrorInfo Create(HttpResponseMessage response, string content)
{
if (response == null)
{
throw new ArgumentNullException("response");
}
CloudHttpResponseErrorInfo info = new CloudHttpResponseErrorInfo();
// Copy CloudHttpErrorInfo properties
info.Content = content;
info.Version = response.Version;
info.CopyHeaders(response.Headers);
info.CopyHeaders(response.GetContentHeaders());
// Copy CloudHttpResponseErrorInfo properties
info.StatusCode = response.StatusCode;
info.ReasonPhrase = response.ReasonPhrase;
return info;
}
示例3: AppendHttpResponse
/// <summary>
/// Append an HTTP response.
/// </summary>
/// <param name="text">The StringBuilder.</param>
/// <param name="response">The response message.</param>
public static void AppendHttpResponse(this StringBuilder text, HttpResponseMessage response)
{
if (response == null)
{
throw new ArgumentNullException("response");
}
text.AppendHttpResponse(
response.StatusCode,
response.ReasonPhrase,
response.Version,
response.Headers,
response.GetContentHeaders(),
response.Content.AsString());
}