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

Add optional stream.PassThrough to stream example #1566

Closed
wants to merge 2 commits into from
Closed

Add optional stream.PassThrough to stream example #1566

wants to merge 2 commits into from

Conversation

Giotino
Copy link
Collaborator

@Giotino Giotino commented Dec 21, 2020

Checklist

  • I have read the documentation.
  • I have included a pull request description of my changes.

@@ -114,7 +114,8 @@ const pipeline = promisify(stream.pipeline);
// For POST, PUT, PATCH, and DELETE methods, `got.stream` returns a `stream.Writable`.
await pipeline(
fs.createReadStream('index.html'),
got.stream.post('https://sindresorhus.com')
got.stream.post('https://sindresorhus.com'),
new stream.PassThrough() // OPTIONAL: We use a PassThrough in order to catch error on response (e.g. HTTP 500)
Copy link
Owner

Choose a reason for hiding this comment

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

I think this would be more useful if we explained why new stream.PassThrough() is even needed in the first place to catch error on the response.

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