node.js - Error while piping POST request using request library -


i'm using request communicate between 2 sails applications. concerned actions seem triggered form data shows undefined.

in app a:

the concerned form

<form action="/testreq" method="post" enctype="multipart/form-data">     <input name="name" type="text"><br/>     <input name="dp" type="file"><br/>     <input type="submit" value="submit"> </form> 

the concerned controller

  testreq: function(req, res, next) {     console.log(req.param('name'));     var r = request.post('http://localhost:9999/upload');     req.pipe(r);     return r.pipe(res);   }, 

in app b:

the concerned controller

upload: function(req, res, next) {     var name = req.param('name');     console.log(name);// prints "undefined"     return res.json({ message: 'some message' }); } 

while console.log should print name sent form, outputs undefined. idea i'm going wrong?


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -