Skip to content

Encoding special symbols with searchParams option #1509

Answered by Giotino
Rom4ig asked this question in Q&A
Discussion options

You must be logged in to vote

TL; DR: With searchParams you can't

Explanation: URLSearchParams follows the WHATWG spec https://url.spec.whatwg.org/#urlsearchparams
The characters you're using are percent encoded (as you noted).
If you want to use a custom query string that doesn't follow the WHATWG spec you've to add it in the URL.

Example:

got('http://example.com/?$format=json;metadata=full')

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sindresorhus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1509 on December 10, 2020 17:07.