Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request return with 400 "bad request" #58

Open
roysG opened this issue May 13, 2017 · 1 comment
Open

request return with 400 "bad request" #58

roysG opened this issue May 13, 2017 · 1 comment

Comments

@roysG
Copy link

roysG commented May 13, 2017

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
Copy link

try method: "POST",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants