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
Is your feature request related to a problem? Please describe.
I suggest to store an intercepted request's URL as a URL instance, as opposed to string.
Benefits
URL class is supported in both browser and Node environments;
Allows to unify internal implementation in the underlying libraries, leading to fewer URL transformations;
Gives more information to the developer, such as req.url.protocol, req.url.port, etc. This information is already available, just not exposed to the developer, which is an experience flaw;
Additional context
There are multiple points of conversion happening, which transform a string representation of a request's URL into a URL instance anyway:
node-request-interceptor converts it to URL in order to provide a clean URL in the middleware function;
msw@getResponse converts to a URL instance to get a clean URL. With Supports running mocks in Node #146 it will also use that URL instance to resolve a relative URL against the current window.location.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I suggest to store an intercepted request's URL as a
URL
instance, as opposed tostring
.Benefits
URL
class is supported in both browser and Node environments;req.url.protocol
,req.url.port
, etc. This information is already available, just not exposed to the developer, which is an experience flaw;Additional context
There are multiple points of conversion happening, which transform a string representation of a request's URL into a
URL
instance anyway:node-request-interceptor
converts it toURL
in order to provide a clean URL in the middleware function;msw@getResponse
converts to aURL
instance to get a clean URL. With Supports running mocks in Node #146 it will also use that URL instance to resolve a relative URL against the currentwindow.location
.The text was updated successfully, but these errors were encountered: