node.js - piping with requestjs in node 0.10 vs higher version -


so need understanding happens when piping requests , if there difference between node 0.10.x , 4.5.x

i have this:

function(req, res, next){   if(req.method === 'put'){     var putoptions = {       uri: config.url + req.url,       headers: {         token: req.session.token       },       jason: req.body     };     var r = request.put(putoptions, callback);     return req.pipe(r).pipe(res);   } } 

now works fine in node 0.10.x, in 4.5.x "write after end" error, unless remove req.pipe-part , r.pipe(res), works fine in 4.5.x.

now in understanding difference between these two, happens, , why behaves differently in different node versions.

thanks help!

---update---

ok when tried req.pipe(r, {end: false}).pipe(res) worked in 4.5.x, i'm no longer getting "write after end"-error ... i'm still bit confused why there difference.. docs regarding pipes doesn't seem have changed since 0.10


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -