Can't send form-urlencoded
Here I put TWO codes, the first WORKS perfectly (it's correct when it says "captcha_error"... it is INCORRECT when it says " "error" ")
FIRST: var http = require("http"); app.get('/obtenerCPA', (req, res) =>{ var options = { host: 'www.correoargentino.com.ar', path: '/sites/all/modules/custom/ca_forms_mobile/api/wsFacade.php', port: '80', method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'} }; var data = 'action=cpa&localidad=5001&calle=Corro&altura=122&provincia=C&g_recaptcha_response='';
var post_req = http.request(options, (response) => {
response.setEncoding('utf8');
response.on('data', function (chunk) {
res.send(chunk);
});
});
post_req.write(data);
post_req.end();
});
SECOND: app.get('/obtenerCPA2', (req, res) =>{ var data = 'action=cpa&localidad=5001&calle=Corro&altura=122&provincia=C&g_recaptcha_response='';
requestify.request('http://www.correoargentino.com.ar/sites/all/modules/custom/ca_forms_mobile/api/wsFacade.php',{
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
dataType: 'form-url-encoded',
body: data
})
.then((response) => {
console.log('Code Status:\t' + JSON.stringify(response.getCode()));
res.send(response.getBody());
}),
(error) => {
res.send(getCode());
}
});
Is this ever going to be addressed? I'm pretty sure requestify is deprecated. I moved over to axios instead for my HTTP requests that require form-urlencoded.