-
Notifications
You must be signed in to change notification settings - Fork 191
Add HttpReqeuest GetEncodedUrl and GetDecodedUrl extensions. #359
Conversation
/// <returns></returns> | ||
public static string GetDecodedUrl(this HttpRequest request) | ||
{ | ||
return request.Scheme + "://" + request.Host.Value + request.PathBase.Value + request.Path.Value + request.QueryString.Value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does all this concatenation work when some sections are missing? E.g. no query string or empty path etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Added tests for empty params.
dabddb6
to
7be5846
Compare
Also commented in the bug:
|
Renamed GetDecodedUrl to GetDisplayUrl. |
@@ -71,5 +71,27 @@ public static string Encode(Uri uri) | |||
return uri.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped); | |||
} | |||
} | |||
|
|||
/// <summary> | |||
/// Returns the combine components of the request URL in a fully escaped form suitable for use in HTTP headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
combined
|
b02655f
to
9c3a391
Compare
#341
@davidfowl @Eilon