Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

help if got a multi-form post working . #447

Closed
guruward opened this Issue Feb 27, 2013 · 2 comments

Comments

Projects
None yet
3 participants

var r = request.post('http://abc.com') ;

var form  = r.form() ;
  form.append('api_key',bio.api_key) ;
  form.append('api_secret', bio.api_secret);
  form.append('files', fs.createReadStream(file))   ;

before I r.pipe(res) ; back to the client how can I capture the data returned to the post . are there other methods besides pipe. so can manipulate the JSON returned from the rest call ?

Owner

mikeal commented Feb 27, 2013

just pass a regular callback.

request.post(url, function (error, response, body) {})

@mikeal If you post a form using:

request.post('http://service.com/upload').form({key:'value'})

How do you then do something with the result of that post operation? This doesn't log anything:

    request.post(targetBaseURL+'/login.php').form({vb_login_username:mtfConfig.user, vb_login_password: mtfConfig.password},function(e,r,b){
        if(error) {
            console.log(error);
        }
        console.log(b);
        utils.log(b);
        $ = cheerio.load(r);

        var loggedIn = $("a:contains('welcome')");
        console.log('logged in');
  });

@mikeal mikeal closed this Aug 28, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment