You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'd be handy if fetch() could also accept a URL instance as the source;
consturl=newURL('...');constdata=awaitfetch(url);
Currently this throws an error:
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of URL
Using URL to generate the source URL can be a common use case, in case you need to safely add query parameters, or control the base/host of the request between environments.
I know it's an easy fix to use url.toString() instead, but it can be a gotcha - it'd be a nifty ergonomic improvement if this was handled automagically!
The text was updated successfully, but these errors were encountered:
It'd be handy if
fetch()
could also accept aURL
instance as the source;Currently this throws an error:
Using
URL
to generate the source URL can be a common use case, in case you need to safely add query parameters, or control the base/host of the request between environments.I know it's an easy fix to use
url.toString()
instead, but it can be a gotcha - it'd be a nifty ergonomic improvement if this was handled automagically!The text was updated successfully, but these errors were encountered: