-
-
Notifications
You must be signed in to change notification settings - Fork 956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How is the URL build in got? Part 2 #1546
Comments
We're not trying to be rude, but it's difficult to convey the tone of a speech through writing. Also, we are trying to help as much as we can, but we can't help everyone with every single problem. We already had a long conversation about how URLs should be presented to the server (#1234 #1236). TL; DR
If you want your server to receive |
BTW, a closed issue does't mean "we don't want talk about it", it's more like "we don't think this is an issue, but feel free to try to change our mind". |
Hello @Giotino, I tested your recent suggestion
and it didn't work. I get this as the result URL {
href: 'https://127.0.0.1/v1/users%3F',
origin: 'https://127.0.0.1',
protocol: 'https:',
username: '',
password: '',
host: '127.0.0.1',
hostname: '127.0.0.1',
port: '',
pathname: '/v1/users%3F',
search: '',
searchParams: URLSearchParams {},
hash: ''
} |
The WHATWG URL object doesn't represent an encoded version. |
I closed the issue because it's not a problem with Got. You just need to learn more about Node.js. Unfortunately our issue tracker is not the right place to do so. Here's why the question mark doesn't get included:
As you can see it uses the
|
That's just an option that if specified, overrides the query string provided in the URL.
|
It's an expected behavior. IMO it works correctly. |
We can even consider the "parent spec" of WHATWG, the RFC 3986 which defines URIs.
There's no If you want your server to receive the |
Issues like this better live on StackOverflow ;) |
@Giotino Node.js expects us to provide decoded URL, so we cannot pass an encoded version, as it will be encoding already encoded version. |
I think |
That's not true, WHATWG expect In fact the request from got('http://127.0.0.1:8123/test%3Ftest') ends up as
|
Pardon me, you're right. An encoded URL is still a valid URL therefore the WHATWG URL accepts it. I got confused by the Lines 39 to 46 in ff918fb
|
That's really the answer which I was looked for. Thank you so much for your effort @szmarczak . I really appreciate all of your answers. Thank you so much for helping me out, guys 😉 |
What would you like to discuss?
As I mentioned in #1545,
now I finally found out, that you use in your code
source/core/index.ts
at line 1580source/core/index.ts
at line 1662Why do you use these
URL.searchParams
instead ofURL.search
?I asked also in nodejs/node#36337
Hope this helps.
And don't be rude to me. 😉 😄
Checklist
The text was updated successfully, but these errors were encountered: