Exemple #1
0
        /// <summary>
        /// Get a standard string representation of an HTTP response.
        /// </summary>
        /// <param name="response">The response message.</param>
        /// <returns>String representation of the response.</returns>
        public static string AsString(this CloudHttpResponseErrorInfo response)
        {
            StringBuilder text = new StringBuilder();

            text.AppendHttpResponse(response);
            return(text.ToString());
        }
Exemple #2
0
        /// <summary>
        /// Get a standard string representation of an HTTP response.
        /// </summary>
        /// <param name="response">The response message.</param>
        /// <returns>String representation of the response.</returns>
        public static string AsString(this HttpResponseMessage response)
        {
            StringBuilder text = new StringBuilder();

            text.AppendHttpResponse(response);
            return(text.ToString());
        }
Exemple #3
0
        /// <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, CloudHttpResponseErrorInfo response)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            text.AppendHttpResponse(
                response.StatusCode,
                response.ReasonPhrase,
                response.Version,
                response.Headers,
                null,
                response.Content);
        }
Exemple #4
0
        /// <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());
        }
Exemple #5
0
        /// <summary>
        /// Convert the CloudException into a helpful string.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            // Get the original exception message (including the InnerException)
            StringBuilder text = new StringBuilder();

            text.AppendLine(base.ToString());
            text.AppendLine();

            // Tack on the request/response
            if (Request != null)
            {
                text.AppendHttpRequest(Request);
            }
            text.AppendLine();
            if (Response != null)
            {
                text.AppendHttpResponse(Response);
            }

            return(text.ToString());
        }
        /// <summary>
        /// Convert the CloudException into a helpful string.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            // Get the original exception message (including the InnerException)
            StringBuilder text = new StringBuilder();
            text.AppendLine(base.ToString());
            text.AppendLine();

            // Tack on the request/response
            if (Request != null)
            {
                text.AppendHttpRequest(Request);
            }
            text.AppendLine();
            if (Response != null)
            {
                text.AppendHttpResponse(Response);
            }

            return text.ToString();
        }
 /// <summary>
 /// Get a standard string representation of an HTTP response.
 /// </summary>
 /// <param name="response">The response message.</param>
 /// <returns>String representation of the response.</returns>
 public static string AsString(this CloudHttpResponseErrorInfo response)
 {
     StringBuilder text = new StringBuilder();
     text.AppendHttpResponse(response);
     return text.ToString();
 }
 /// <summary>
 /// Get a standard string representation of an HTTP response.
 /// </summary>
 /// <param name="response">The response message.</param>
 /// <returns>String representation of the response.</returns>
 public static string AsString(this HttpResponseMessage response)
 {
     StringBuilder text = new StringBuilder();
     text.AppendHttpResponse(response);
     return text.ToString();
 }