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

Fix the incorrect example of an afterResponse hook #1115

Merged
merged 4 commits into from Mar 11, 2020

Conversation

rifler
Copy link
Contributor

@rifler rifler commented Mar 11, 2020

fixes #1114

Checklist

  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.
  • If it's a new feature, I have included documentation updates.

@szmarczak szmarczak changed the title Incorrect example with afterResponse hook Fix the incorrect example of an afterResponse hook Mar 11, 2020
@@ -114,8 +114,7 @@ const gotInstance = got.extend({
response => {
const {options} = response.request;
if (options.jsonReviver && options.responseType === 'json') {
options.responseType = 'text';
response.body = JSON.parse(response.body, options.jsonReviver);
response.body = JSON.parse(JSON.stringify(response.body), options.jsonReviver);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

response.body is an object here, lemme fix this example.

@szmarczak szmarczak merged commit f726390 into sindresorhus:master Mar 11, 2020
@rifler rifler deleted the patch-1 branch May 27, 2020 10:42
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

Successfully merging this pull request may close these issues.

Incorrect example of an afterResponse hook
2 participants