diff --git a/Test/Flurl.Test/Http/CookieTests.cs b/Test/Flurl.Test/Http/CookieTests.cs index 60a7f9fb..93f66525 100644 --- a/Test/Flurl.Test/Http/CookieTests.cs +++ b/Test/Flurl.Test/Http/CookieTests.cs @@ -162,12 +162,6 @@ public void cannot_change_cookie_after_adding_to_jar() { Assert.Throws(() => cookie.Secure = false); } - [Test] - public void url_decodes_cookie_value() { - var cookie = CookieCutter.ParseResponseHeader("https://cookies.com", "x=one%3A%20for%20the%20money"); - Assert.AreEqual("one: for the money", cookie.Value); - } - [Test] public void unquotes_cookie_value() { var cookie = CookieCutter.ParseResponseHeader("https://cookies.com", "x=\"hello there\"" ); diff --git a/src/Flurl.Http/CookieCutter.cs b/src/Flurl.Http/CookieCutter.cs index c74c0d62..95cdc727 100644 --- a/src/Flurl.Http/CookieCutter.cs +++ b/src/Flurl.Http/CookieCutter.cs @@ -19,7 +19,7 @@ public static class CookieCutter if (string.IsNullOrEmpty(headerValue)) yield break; foreach (var pair in GetPairs(headerValue)) - yield return (pair.Name, Url.Decode(pair.Value, false)); + yield return (pair.Name, pair.Value); } /// @@ -34,7 +34,7 @@ public static FlurlCookie ParseResponseHeader(string url, string headerValue) { FlurlCookie cookie = null; foreach (var pair in GetPairs(headerValue)) { if (cookie == null) - cookie = new FlurlCookie(pair.Name, Url.Decode(pair.Value.Trim('"'), false), url, DateTimeOffset.UtcNow); + cookie = new FlurlCookie(pair.Name, pair.Value.Trim('"'), url, DateTimeOffset.UtcNow); // ordinal string compare is both safest and fastest // https://docs.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#recommendations-for-string-usage @@ -72,7 +72,7 @@ public static string ToRequestHeader(IEnumerable<(string Name, string Value)> co if (cookies?.Any() != true) return null; return string.Join("; ", cookies.Select(c => - $"{Url.Encode(c.Name)}={Url.Encode(c.Value)}")); + $"{c.Name}={c.Value}")); } ///