node-oauth
node-oauth copied to clipboard
Unable to process stream response with _performSecureRequest
Hi there, and thanks for this great oAuth implementation.
However, i found myself unable to work with stream response with actual implementation, because _performSecureRequest
wait for the end / close event before returning data.
A simple fix would be passBackControl
immediately, when response is a stream, and let the user collect the chunk:
if ( response.headers["transfer-encoding"] == "chunked")
passBackControl( response );
Hoping that helps :-)
Not sure that I agree with the fix suggested here, but this library does need the ability to deal with streamed responses over a long lived connection. +1 eg: Twitter has a streaming API.
After taking a longer peek at the source, it looks like omitting a callback makes _performSecureRequest
return the node request object, which you can then treat any way you want.
Yes I remember that was for the Twitter streaming API, but that was 2 years now, no PR was merged in the meanwhile?
@ciaranj Would you accept a PR that contained a new example of how to interact with Twitter's streaming API?