-
Notifications
You must be signed in to change notification settings - Fork 756
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
Binary streaming #1157
Conversation
cf771e6
to
f825d89
Compare
10cea53
to
e0469af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall! Extremely minor comments - thanks Richard!
87f1e7b
to
2923bde
Compare
r? @dcr-stripe - the problem was that there were test cases that were supposed to trigger timeouts by never calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
problem was that there were test cases that were supposed to trigger timeouts by never calling
res.end()
. In these cases, the "finish" or "close" events wouldn't fire. There's not really a cute way to automatically close the server in these cases after the test case is finished, so I had the helper expose acloseServer
function to trigger manually on the test case, for now.
Ahhh good find. Makes sense! Thanks for digging into this Richard - LGTM! 🚢
Notify
r? @dcr-stripe
cc @stripe/api-libraries
Summary
This PR adds support for defining 'streaming' stripe methods on the Stripe client. Unlike existing methods, 'streaming' methods do not buffer the response body into memory and try to parse it into json -- they pass the underlying
http.Request
object to the caller, so that the caller can pipe it to a file or socket without having to buffer it.The motivation for this is an upcoming
/pdf
method that will return a pdf instead of JSON.Also incidentally adds the ability to set "host" per-request, this was useful in my testing.