当前位置: 首页>>代码示例>>C#>>正文


C# HttpResponseMessage.GetContentHeaders方法代码示例

本文整理汇总了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;
        }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:18,代码来源:HttpResponseMessageWrapper.cs

示例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;
        }
开发者ID:ranjitk9,项目名称:azure-sdk-tools,代码行数:30,代码来源:CloudHttpResponseErrorInfo.cs

示例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());
        }
开发者ID:ranjitk9,项目名称:azure-sdk-tools,代码行数:20,代码来源:HttpExtensions.cs


注:本文中的System.Net.Http.HttpResponseMessage.GetContentHeaders方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。