-
I am trying to write a set of unit tests , and using nock to mock the request from got. I am trying to test if the system catches and handles http errors, so I am using nock to reply with 404, 501 etc With every error I throw, there always seems to be an "e.response" . However, the docs say Additionally, the errors may have request (Got Stream) and response (Got Response) properties depending on which phase of the request failed. So, getting to the title of the issue - does the error object always have a response ? If not, does anyone know how to use nock to simulate that particular failure ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
The docs specify those who do have them and those who don't. For example: https://github.com/sindresorhus/got#gotparseerror |
Beta Was this translation helpful? Give feedback.
The docs specify those who do have them and those who don't. For example: https://github.com/sindresorhus/got#gotparseerror