-
Notifications
You must be signed in to change notification settings - Fork 20
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
WHATWG URL not working #15
Comments
Hey, can you show me exactly what you're sending? Any URL objects are left as they are. Strings are parsed into URL object via |
hi, A Node.js WHATWG URL: const { get } = require("httpie");
async function main() {
const { statusCode } = await get(new URL("https://www.google.fr/"));
console.log(statusCode);
}
main().catch(console.error); Best Regards, |
Thanks, I knew what it was 😄 But you're right, I was handling it incorrectly. Turns out that when you merge a let foo = new URL("https://www.google.fr/");
console.log(foo);
/*
URL {
href: 'https://www.google.fr/',
origin: 'https://www.google.fr',
protocol: 'https:',
username: '',
password: '',
host: 'www.google.fr',
hostname: 'www.google.fr',
port: '',
pathname: '/',
search: '',
searchParams: URLSearchParams {},
hash: '' }
*/
console.log({ ...foo });
/*
{ [Symbol(context)]:
URLContext {
flags: 400,
scheme: 'https:',
username: '',
password: '',
host: 'www.google.fr',
port: null,
path: [ '' ],
query: null,
fragment: null },
[Symbol(query)]: URLSearchParams {} }
*/ This is also a different behavior than the (legacy) |
Released in |
Hi,
The Type definition for your method take
string | Url
but you seem to have forgotten to transform the URL to a standard string. If we send an URL, it throw the following error:Best Regards,
Thomas
The text was updated successfully, but these errors were encountered: