Graphileon 代理功能问题

Graphileon Proxy Feature issue

我们正在尝试使用 Graphileon 代理功能,但每次我们都会收到以下错误:

{"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

这是我们使用的代码:

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
})

你能帮忙补一下遗失的东西吗?

body 也必须是 JSON 所以你需要做:

var body = JSON.stringify({
                    url: schemaUrl,
                    method: 'POST',
                    body: JSON.stringify({
                            state : "*",
                            bucket:
                            [
                                {name: "Ram", tr1: "TR1", TC1: 1}
                            ]
                        })
                });