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

new Request(...) ignores url property #7836

Closed
bnoordhuis opened this issue Oct 6, 2020 · 6 comments
Closed

new Request(...) ignores url property #7836

bnoordhuis opened this issue Oct 6, 2020 · 6 comments
Labels
bug Something isn't working correctly invalid what appeared to be an issue with Deno wasn't web related to Web APIs

Comments

@bnoordhuis
Copy link
Contributor

> new Request(undefined, { url: "https://deno.land/" });
Request {
  _bodySource: "",
  _stream: null,
  headers: Headers {},
  method: "GET",
  url: "",              // <- WRONG
  credentials: "omit"
}

// readonly attribute USVString url;
this.url = "";

@bnoordhuis bnoordhuis added bug Something isn't working correctly web related to Web APIs labels Oct 6, 2020
@bnoordhuis
Copy link
Contributor Author

Apologies, I retract this bug report. I believe the real bug is that new Request(undefined) should throw an "invalid URL" TypeError.

@bnoordhuis bnoordhuis added the invalid what appeared to be an issue with Deno wasn't label Oct 6, 2020
@nayeemrmn
Copy link
Collaborator

nayeemrmn commented Oct 6, 2020

In browsers Chrome, the undefined gets stringified. Seems easier.

@bnoordhuis
Copy link
Contributor Author

FWIW, Firefox 81.0.1 throws an "undefined is not a valid URL" TypeError.

@lucacasonato
Copy link
Member

In browsers Chrome, the undefined gets stringified. Seems easier.

That sounds like a Chrome bug:

https://fetch.spec.whatwg.org/#dom-request says first param may be a string, otherwise it must be asserted to be a Request object. I assume that means throw a TypeError if it is not one of the two.

@lucacasonato
Copy link
Member

FWIW, Firefox 81.0.1 throws an "undefined is not a valid URL" TypeError.

Actually can't reproduce on 81.0. For me it does the same as Chrome (which does the same as Safari)

@lucacasonato
Copy link
Member

So it seems the stringified undefined is intended behavior:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly invalid what appeared to be an issue with Deno wasn't web related to Web APIs
Projects
None yet
Development

No branches or pull requests

3 participants