Error on piping a request to a destination #31

merged 1 commit into from May 25, 2011


None yet

2 participants


i was getting a weird error using the master branch of request and sending it to a file:

TypeError: Cannot call method 'apply' of undefined
    at [object Object].resume (/Users/topper/Sites/snap/javascript-openstack-object/lib/request.js:310:19)
    at [object Object].ondrain (stream.js:43:33)
    at [object Object].emit (events.js:61:17)
    at [object Object].flush (fs.js:1010:32)
    at fs.js:1051:10
    at wrapper (fs.js:295:17)

I changed pause and resume to operate on response instead of request. However, I'm not sure if there will be any consequences to the change.

mikeal commented May 24, 2011

my brain hurts, but i think this is correct.

Request is a duplexed read/write stream. pause() and resume() are for readable streams, when the Request stream is being read it's in relation to the HTTP response, not the HTTP request, so I think this is all right.

Did you happen to run test/test-pipes?


yup - says "All tests passed." - but the tests don't actually check for pause/resume. However - I think we're right that pause/resume should only happen on response.

mikeal commented May 25, 2011

i'm gonna merge this today and write a test for it sometime this week before i release.

@mikeal mikeal merged commit 53e7ad0 into request:master May 25, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment