I am using node.js to send HTTP POST to an APP server. The email address [email protected] in POST body shows up as joe%40gmail.com on APP server side. I used Content-Type text/plain in the following code but application/x-www-form-urlencoded is actually in the POST request header, according to the server log.
My earlier post has a mistake on Chrome postman results. Please ignore it, and sorry for the confusion.
I am new to this, and may have missed something obvious here. Any help is appreciated.
Here is the code:
var express = require("express");
var app = module.exports = express();
var request = require('request');
var config = require('../config');
app.post('/', function(req, res) {
var username = req.body.name;
var password = req.body.passwd;
var email = req.body.email;
console.log("email=", email);
// connect to APP server
var url = config.appServer;
request( {
uri: url,
method: "POST",
timeout: 10000, // 10 sec
headers: {
'Content-Type': 'text/plain'
},
form: {
act: 'create',
username : username,
passwd: password,
email: email
}
}, function (error, response, body) {
// handle return here
decodeURIComponent()it ? - adeneoconsole.logoutputs the right string. Update the question with the code of the/accountpost handler - gfpacheco