duosecurity / duo_api_nodejs

Other
20 stars 20 forks source link

JSON.parse error because https stream closes too soon #4

Closed mpint closed 8 years ago

mpint commented 9 years ago

Added listener for 'end of stream' event. The current code failed on multiple requests because it prematurely sends the response to the callback, and JSON.parse is called on an incomplete json document. Adding the 'end' event listener keeps the connection open until the entire document is received.

ben-duo commented 8 years ago

Excellent! Thank you for finding and fixing this issue! If you would please squash these into one commit I'll merge it.

mpint commented 8 years ago

Done.

ben-duo commented 8 years ago

Thanks again!