I'm having trouble to make a request on node that was tested and worked on Postman. Everything I tried return me a 302 status code.
This is the request I want to do, it works just fine executing on postman:
This is one of my attempts:
function ListaCidades(estado) {
return new Promise((resolve, reject) => {
request({
url: "http://www1.caixa.gov.br/Simov/carregaListaCidades.asp",
method: "POST",
body: "cmb_estado=MG&cmb_cidade=&cmb_tp_venda=0&cmb_tp_imovel=Selecione&cmb_area_util=Selecione&cmb_faixa_vlr=Selecione&cmb_quartos=Selecione&cmb_vg_garagem=Selecione"
}, function callback(error, resp, body) {
if (error)
{
reject(error);
process.exit(1);
}
resolve(resp.statusCode);
})
});
}
I'm getting HTTP 302 as status code and a empty body.
What is wrong?