got icon indicating copy to clipboard operation
got copied to clipboard

`.json` on the promise is not defined

Open luxzeitlos opened this issue 7 years ago • 3 comments

Describe the bug

  • Node.js version: 10.15.3
  • OS & version: Linux (Nixos)
  • got version: 9.6.0

Expected behavior

The example here seems to suggest this to work.

Code to reproduce

...
> got.get('https://gitlab.com/api/v4/groups/').json()
TypeError: got.get(...).json is not a function
>
>
> got('https://gitlab.com/api/v4/groups/').json()
TypeError: got(...).json is not a function

So did I understand the documentation wrong or is this a bug?

luxzeitlos avatar Aug 29 '19 06:08 luxzeitlos

This threw me as well. The documentation on the README is actually for the next version. You want the npm docs for the current version.

Looking through the bug list, this has caught a few people out.

rmp135 avatar Aug 31 '19 09:08 rmp135

This is clearly pointed out at the top of the readme. In addition, this is how almost all projects work on GitHub; master branch is development.

sindresorhus avatar Aug 31 '19 13:08 sindresorhus

We have an alpha version of v10 out now if you wanna help us test: https://github.com/sindresorhus/got/releases/tag/v10.0.0-alpha.1

sindresorhus avatar Sep 17 '19 09:09 sindresorhus