public override string ToString()
        {
            var builder = new StringBuilder(512);

            builder.AppendLine($"{GetType().FullName}: {Message}");
            builder.AppendLine($"Request: {HttpMethod} {Uri}");

            if (RequestHeaders != null && RequestHeaders.Any())
            {
                builder.AppendLine("Request headers:");
                builder.AppendLine(String.Join(Environment.NewLine, RequestHeaders.Select(h => $"{h.Key}: [{String.Join(", ", h.Value)}]")));
            }

            if (RequestContentHeaders != null && RequestContentHeaders.Any())
            {
                builder.AppendLine("Request content headers:");
                builder.AppendLine(String.Join(Environment.NewLine, RequestContentHeaders.Select(h => $"{h.Key}: [{String.Join(", ", h.Value)}]")));
            }

            if (!String.IsNullOrEmpty(RequestContent))
            {
                builder.AppendLine("Request content:");
                if (RequestContent.Length > MaximumBodyLength)
                {
                    builder.Append(RequestContent.Substring(0, MaximumBodyLength));
                    builder.AppendLine("\u2026");
                }
                else
                {
                    builder.AppendLine(RequestContent);
                }
            }

            if (StatusCode.HasValue)
            {
                builder.AppendLine($"Status: {ReasonPhrase} ({(int)StatusCode})");
            }

            if (ResponseHeaders != null && ResponseHeaders.Any())
            {
                builder.AppendLine("Response headers:");
                builder.AppendLine(String.Join(Environment.NewLine, ResponseHeaders.Select(h => $"{h.Key}: [{String.Join(", ", h.Value)}]")));
            }

            if (ResponseContentHeaders != null && ResponseContentHeaders.Any())
            {
                builder.AppendLine("Response content headers:");
                builder.AppendLine(String.Join(Environment.NewLine, ResponseContentHeaders.Select(h => $"{h.Key}: [{String.Join(", ", h.Value)}]")));
            }

            if (!String.IsNullOrEmpty(ResponseContent))
            {
                builder.AppendLine("Response content:");

                if (ResponseContent.Length > MaximumBodyLength)
                {
                    builder.Append(ResponseContent.Substring(0, MaximumBodyLength));
                    builder.AppendLine("\u2026");
                }
                else
                {
                    builder.AppendLine(ResponseContent);
                }
            }

            if (InnerException != null)
            {
                builder.AppendLine("Inner exception:");
                builder.AppendLine(InnerException.ToString());
            }
            else
            {
                builder.AppendLine("Stack trace:");
                builder.AppendLine(StackTrace);
            }

            return(builder.ToString());
        }