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

Binary streaming #1157

Merged
merged 4 commits into from
Jun 25, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix comments
  • Loading branch information
richardm-stripe committed Jun 24, 2021
commit 0dab6ab0098ee9099a0c224bc8baa6fc02792fa1
14 changes: 10 additions & 4 deletions lib/StripeResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ StripeResource.prototype = {
_addHeadersDirectlyToResponse(res, headers) {
// For convenience, make some headers easily accessible on
// lastResponse.

// NOTE: Stripe responds with lowercase header names/keys.
res.requestId = headers['request-id'];
res.stripeAccount = res.stripeAccount || headers['stripe-account'];
res.apiVersion = res.apiVersion || headers['stripe-version'];
Expand All @@ -130,10 +132,14 @@ StripeResource.prototype = {
},

/**
* Used by methods with spec.streaming === true. For these methods, we do not buffer the
* response into memory, or do any parsing into stripe objects or errors, we
* delegate that all of that to the user and pass back the raw http.Response
* object to the callback.
* Used by methods with spec.streaming === true. For these methods, we do not
* buffer successful responses into memory or do parse them into stripe
* objects, we delegate that all of that to the user and pass back the raw
* http.Response object to the callback.
*
* (Unsuccessful responses shouldn't make it here, they should
* still be buffered/parsed and handled by _jsonResponseHandler -- see
* makeRequest)
*/
_streamingResponseHandler(req, callback) {
return (res) => {
Expand Down