コード例 #1
0
        /// <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;
        }
コード例 #2
0
        /// <summary>
        /// Creates a new CloudHttpResponseErrorInfo from a HttpResponseMessage.
        /// </summary>
        /// <param name="response">The response 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);
        }