mswjs / interceptors

Low-level network interception library.
https://npm.im/@mswjs/interceptors
MIT License
535 stars 120 forks source link

Handle http.request() with no options #461

Closed mikicho closed 10 months ago

mikicho commented 11 months ago

From nock's source code:

// As weird as it is, it's possible to call http.request without // options, and it makes a request to localhost or somesuch. We should // support it too, for parity. However it doesn't work today, and fixing // it seems low priority. Giving an explicit error is nicer than // crashing with a weird stack trace. new ClientRequest(), nock's // other client-facing entry point, makes a similar check. // https://github.com/nock/nock/pull/1386 // https://github.com/nock/nock/pull/1440

I think we should follow and just throw error. currently we throw:

Cannot use 'in' operator to search for 'hash' in undefined

kettanaito commented 10 months ago

Released: v0.25.7 🎉

This has been released in v0.25.7!

Make sure to always update to the latest version (npm i @mswjs/interceptors@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.