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

Use responseType instead of options.encoding to get a Buffer #940

Merged
merged 4 commits into from Nov 24, 2019

Conversation

szmarczak
Copy link
Collaborator

#921 (comment)

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.

@sindresorhus
Copy link
Owner

Can you add a test to ensure got and responseType: 'buffer' works even when the encoding option is set?

@sindresorhus
Copy link
Owner

You need to remove the null and Buffer mention here: https://github.com/sindresorhus/got#encoding And also say that it only applies when the response type is some kind of string.

@sindresorhus
Copy link
Owner

You also need to update:

test/progress.ts
74:	const {body} = await got({encoding: null})
95:	const stream = got.stream({encoding: null})

@sindresorhus
Copy link
Owner

I think we should throw if got({encoding: null}) saying that the user should use got({responseType: 'buffer'}) instead.

@sindresorhus sindresorhus merged commit 6cc3d9f into sindresorhus:master Nov 24, 2019
Beanow added a commit to sourcecred/widgets that referenced this pull request Jan 15, 2020
Full list of breaking changes listed here.
https://github.com/sindresorhus/got/releases/tag/v10.0.0

One breaking change affected our usage:
"Use the responseType option instead of encoding to get a Buffer"
sindresorhus/got#940

- got(…, {encoding: null});
+ got(…, {responseType: 'buffer'});
Beanow added a commit to sourcecred/widgets that referenced this pull request Jan 15, 2020
Full list of breaking changes listed here.
https://github.com/sindresorhus/got/releases/tag/v10.0.0

One breaking change affected our usage:
"Use the responseType option instead of encoding to get a Buffer"
sindresorhus/got#940

- got(…, {encoding: null});
+ got(…, {responseType: 'buffer'});
Beanow added a commit to sourcecred/widgets that referenced this pull request Jan 15, 2020
Full list of breaking changes listed here.
https://github.com/sindresorhus/got/releases/tag/v10.0.0

One breaking change affected our usage:
"Use the responseType option instead of encoding to get a Buffer"
sindresorhus/got#940

- got(…, {encoding: null});
+ got(…, {responseType: 'buffer'});
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.

None yet

2 participants