request return with 400 "bad request"
roysG opened this issue · 1 comments
roysG commented
I have request that work in the curl in the command line but not work with your library on node js.
The request in curl command line(WORK):
curl -X POST "http://run.selfiecash.me:8080/predict" -d '{
"service":"getAge",
"parameters":{
"output":{
"best":5
}
},
"data":["https://scontent-frx5-1.cdninstagram.com/t51.2885-19/11856752_515409661959330_1395087449_a.jpg"]
}'
The request through your library(Not Work):
var options = {
url: 'http://run.selfiecash.me:8080/predict',
method: "post",
include:true,
headers:{
'Accept' : 'application/json',
'Content-Length' : post_data.length,
"Content-Type" : "application/json"
},
data:data,
};
curl.request(options, function (err2, parts) {
parts = parts.split('\r\n');
var data = parts.pop();
console.log(err2,parts);
});
Why i get error 400 ?
WioSwitch commented
try method: "POST",