-
-
Notifications
You must be signed in to change notification settings - Fork 148
Closed
Milestone
Description
const { ClientRequestInterceptor } = require('@mswjs/interceptors/ClientRequest')
const http = require('http');
const interceptor = new ClientRequestInterceptor({
name: 'my-interceptor',
})
interceptor.apply();
interceptor.on('request', ({ request }) => {
request.respondWith(new Response('hello'))
});
http.get('http://nowhere.com/', res => {
res.destroy(new Error('hey'))
})
.on('error', e => {
console.log(e) // never get here!!!
})
Instead of getting to the req's error
listener, this throws an error.
Expected behavior: I think we need to listen to the error
event in the request (from the socket) and pass it through.
docs
Metadata
Metadata
Assignees
Labels
No labels