We are trying to use the Graphileon proxy feature, but everytime we are getting error as:
{"request":{"url":"http://127.0.0.1:8080/score/api","method":"POST","body":{"state":"*","bucket":[{"name":"Ram","tr1":"TR1","TC1":1}]}},"error":{"message":"Request `body` must be string or plain object(when `json`: true)","code":400},"code":400} with Status code 400
Here is the code we are using:
var schemaUrl = "http://localhost:8080/score/api";
var body = JSON.stringify({
url: schemaUrl,
method: 'POST',
body: {
state : "*",
bucket:
[
{name: "Ram", tr1: "TR1", TC1: 1}
]
}
});
console.log("body == " body);
$.ajax({
url: "/proxy",
method: "POST",
data: body
})
Can you please help what is missing?
CodePudding user response:
The body
must also be JSON so you need to do:
var body = JSON.stringify({
url: schemaUrl,
method: 'POST',
body: JSON.stringify({
state : "*",
bucket:
[
{name: "Ram", tr1: "TR1", TC1: 1}
]
})
});