- From: Domenic Denicola <notifications@github.com>
- Date: Fri, 02 Mar 2018 01:16:13 -0800
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 2 March 2018 09:17:34 UTC
The fact that `URLSearchParams` uses the application/x-www-form-urlencoded parser whereas the URL parser uses a different parser has unintuitive results when comparing `url.search` and `url.searchParams`: ```js let a = 'http://localhost:9999/segment?foo=bar/baz? boo'; let b = 'http://localhost:9999/segment?foo=bar%2Fbaz%3F%20boo'; let urlA = new URL(a); let urlB = new URL(b); // Not equal: console.log(urlA.search); // "?foo=bar/baz?%20boo" console.log(urlB.search); // "?foo=bar%2Fbaz%3F%20boo" // Equal: console.log(urlA.searchParams.get("foo")); // "bar/baz? boo" console.log(urlB.searchParams.get("foo")); // "bar/baz? boo" // Equal, but different from search: console.log(urlA.searchParams.toString()); // "foo=bar%2Fbaz%3F+boo" console.log(urlB.searchParams.toString()); // "foo=bar%2Fbaz%3F+boo" ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/url/issues/18#issuecomment-369865339
Received on Friday, 2 March 2018 09:17:34 UTC