node-nock/nock#768

node v8.17.0
version: 1.0.0
endpointsharetweet
Reproduceable testcase for https://github.com/node-nock/nock/issues/768
const http = require('http') const nock = require('nock@9.0.27') const data = {foo: 'bar'} nock('http://example.com') .post("/baz", {foo: 'bar'}) .replyWithError('invalid request') const request = http.request({ hostname: 'example.com', port: 80, path: '/baz', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': JSON.stringify(data).length } }) request.on('error', console.log) request.write(JSON.stringify(data)) request.end() // logs Error: invalid request
Loading…

no comments

    sign in to comment