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
When got is used together with nock, but the request that got makes is not defined in nock (e.g. nock mocks a different path), an unexpected error is thrown: socket hang up.
This did not happen in got v10 with the same nock version.
Actual behavior
$ node got-bug-report.js
events.js:187
throw er; // Unhandled 'error' event
^
Error: socket hang up
at InterceptedRequestRouter.handleAbort (/home/dev/node_modules/nock/lib/intercepted_request_router.js:200:28)
at OverriddenClientRequest.req.abort (/home/dev/node_modules/nock/lib/intercepted_request_router.js:79:35)
at PromisableRequest._destroy (/home/dev/node_modules/got/dist/source/core/index.js:1026:32)
at PromisableRequest.destroy (internal/streams/destroy.js:38:8)
at PromisableRequest.<anonymous> (/home/dev/node_modules/got/dist/source/as-promise/index.js:188:25)
at Object.onceWrapper (events.js:300:26)
at PromisableRequest.emit (events.js:210:5)
at PromisableRequest._beforeError (/home/dev/node_modules/got/dist/source/as-promise/core.js:113:14)
at OverriddenClientRequest.<anonymous> (/home/dev/node_modules/got/dist/source/core/index.js:766:18)
at Object.onceWrapper (events.js:300:26)
Emitted 'error' event on OverriddenClientRequest instance at:
at /home/dev/node_modules/nock/lib/intercepted_request_router.js:108:11
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
code: 'ECONNRESET'
}
Expected behavior
Using axios and nock the same sample code results in this error:
$ node got-bug-report.js
Error Error: Nock: No match for request {
"method": "GET",
"url": "https://example.com/bar",
"headers": {
"accept": "application/json, text/plain, */*"
}
}
Describe the bug
got
version: 11.1.1nock
version: 12.0.3When
got
is used together withnock
, but the request thatgot
makes is not defined innock
(e.g. nock mocks a different path), an unexpected error is thrown:socket hang up
.This did not happen in got v10 with the same
nock
version.Actual behavior
Expected behavior
Using
axios
andnock
the same sample code results in this error:Code to reproduce
Checklist
The text was updated successfully, but these errors were encountered: