> new Request(undefined, { url: "https://deno.land/" });
Request {
_bodySource: "",
_stream: null,
headers: Headers {},
method: "GET",
url: "", // <- WRONG
credentials: "omit"
}
Apologies, I retract this bug report. I believe the real bug is that new Request(undefined) should throw an "invalid URL" TypeError.
In ~browsers~ Chrome, the undefined gets stringified. Seems easier.
FWIW, Firefox 81.0.1 throws an "undefined is not a valid URL" TypeError.
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.
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)
So it seems the stringified undefined is intended behavior:
