Skip to content
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

Allow query option to be a URLSearchParams instance #554

Closed
sindresorhus opened this issue Aug 11, 2018 · 0 comments
Closed

Allow query option to be a URLSearchParams instance #554

sindresorhus opened this issue Aug 11, 2018 · 0 comments
Labels
enhancement This change will extend Got features good for beginner This issue is easy to fix ✭ help wanted ✭

Comments

@sindresorhus
Copy link
Owner

For better WHATWG URL compatibility.

https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams

URLSearchParams supports a string too, so we could just always run it through URLSearchParams no matter what, for consistency and code simplicity:

if (!is.string(query)) {
options.query = (new URLSearchParamsGlobal(query)).toString();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This change will extend Got features good for beginner This issue is easy to fix ✭ help wanted ✭
Projects
None yet
Development

No branches or pull requests

1 participant