Commit ff43b5c9 authored by Shani Elharrar's avatar Shani Elharrar

More DebuggerDisplays

parent 580e6265
using System; using System;
using System.Text;
namespace uhttpsharp.Headers namespace uhttpsharp.Headers
{ {
...@@ -30,5 +31,17 @@ namespace uhttpsharp.Headers ...@@ -30,5 +31,17 @@ namespace uhttpsharp.Headers
headers.TryGetByName(name, out value); headers.TryGetByName(name, out value);
return value; return value;
} }
public static string ToUriData(this IHttpHeaders headers)
{
var builder = new StringBuilder();
foreach (var header in headers)
{
builder.AppendFormat("{0}={1}&", Uri.EscapeDataString(header.Key), Uri.EscapeDataString(header.Value));
}
return builder.ToString(0, builder.Length - 1);
}
} }
} }
\ No newline at end of file
...@@ -19,12 +19,14 @@ ...@@ -19,12 +19,14 @@
using System; using System;
using System.CodeDom; using System.CodeDom;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using uhttpsharp.Headers; using uhttpsharp.Headers;
namespace uhttpsharp namespace uhttpsharp
{ {
[DebuggerDisplay("{Method} {OriginalUri,nq}")]
internal class HttpRequest : IHttpRequest internal class HttpRequest : IHttpRequest
{ {
private readonly IHttpHeaders _headers; private readonly IHttpHeaders _headers;
...@@ -80,6 +82,20 @@ namespace uhttpsharp ...@@ -80,6 +82,20 @@ namespace uhttpsharp
{ {
get { return _queryString; } get { return _queryString; }
} }
internal string OriginalUri
{
get
{
if (QueryString == null)
{
return Uri.OriginalString;
}
return Uri.OriginalString + "?" + QueryString.ToUriData();
}
}
} }
public interface IHttpRequest public interface IHttpRequest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment