Mocked Request throwing error when converted to json #1943
Replies: 1 comment
-
|
the make sure you're importing got correctly using ESM: import got from 'got';also, nock only mocks one request by default - you need to either disable retries or call nock('https://example.com')
.get('/version')
.reply(200, {version: '1.0'})
.persist();
// or
await got('https://example.com/version', {retry: {limit: 0}}).json(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Im currently tring to test a got request using jest using nock to intercept requests.
this is the got request
However when the request is called its return the error
'got_1.default.get(...).json is not a function'
This error doesnt occur is the request is not mocked
not sure if this is a error or i am doing someting wrong
Beta Was this translation helpful? Give feedback.
All reactions