Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems that got does not compatible with nock as of version 12. #1960

Closed
2 tasks done
huturen opened this issue Jan 9, 2022 · 3 comments
Closed
2 tasks done

It seems that got does not compatible with nock as of version 12. #1960

huturen opened this issue Jan 9, 2022 · 3 comments

Comments

@huturen
Copy link
Contributor

huturen commented Jan 9, 2022

It seems that got does not compatible with nock as of version 12.

  • Node.js version: v14.17.6
  • OS & version: ^12.0.0

Code to reproduce

import got from 'got';
import nock from 'nock';

nock('https://jsonplaceholder.typicode.com')
  .get('/todos/1')
  .reply(200, {
    id: 1,
    title: 'mock content'
  })

got.get('https://jsonplaceholder.typicode.com/todos/1').then(res => {
  console.log('res body:', res.body);
});

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.
@huturen
Copy link
Contributor Author

huturen commented Jan 9, 2022

I've submitted a pull request to fix it:

#1959

@sindresorhus
Copy link
Owner

@astrolemonade
Copy link

astrolemonade commented Sep 19, 2023

I think the issue is present with the latest versions of got 13 and nock 13.3.3. Does got work with Node js fetch nock/nock#2397? nock/nock#2397 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants