Open mikicho opened 3 days ago
it('allows json response', done => {
14.beta-8+
20
it('allows json response', done => { const scope = nock('http://example.test') .post('/echo') .replyWithError({ message: 'Service not found', code: 'test' })
const req = http.request({ host: 'example.test', method: 'POST', path: '/echo', port: 80, }) req.on('error', e => { expect(e).to.deep.equal({ message: 'Service not found', code: 'test', }) scope.done() done() }) req.end()
})
Copy of this to discuss about a workaround and follow the error from nock POV
nock
@marikaner If it happens for interceptors with the replyWithError function, you can make sure you throw an Error object.
replyWithError
Error
Please avoid duplicates
Reproducible test case
it('allows json response', done => {
Nock Version
14.beta-8+
Node Version
20
TypeScript Version
it('allows json response', done => { const scope = nock('http://example.test') .post('/echo') .replyWithError({ message: 'Service not found', code: 'test' })
})
What happened?
Copy of this to discuss about a workaround and follow the error from
nock
POVWould you be interested in contributing a fix?