got
got copied to clipboard
`.json` on the promise is not defined
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?
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.
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.
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