0

kinvey コンソールを使用している人向け - API コンソールを介してカスタム エンドポイントに単純なポスト リクエストを作成しようとしていますが、jsonParse エラーが発生しています。

エンポイントコードは -

 function onRequest(request, response, modules){
    modules.logger.info(request.body.name + " has " + request.body.eyes + " eyes.");
    response.complete(200);
}

リクエスト -

POST https://baas.kinvey.com/rpc/kid_TVdEjbOoXi/custom/test HTTP/1.1
Authorization: "xxx" //my authorization number
X-Kinvey-API-Version: 3
Content-Type: application/json

{
  "name": "Fred Jones",
  "eyes": "Blue"
}

応答

HTTP/1.1 400
Content-Type: application/json
X-Kinvey-Request-Id: "XXX" // the request id
X-Powered-By: Express

{
  "error": "JSONParseError",
  "description": "Unable to parse the JSON in the request",
  "debug": "Unexpected token a"
}

誰が問題が何であるか知っていますか?

4

1 に答える 1

1

私は Kinvey のエンジニアで、あなたを助けることができます。

ヘッダー値を引用符で囲み、Content-Type文字列として解析できるようにします。

POST https://baas.kinvey.com/rpc/kid_TVdEjbOoXi/custom/test HTTP/1.1
Authorization: "xxx" //my authorization number
X-Kinvey-API-Version: 3
Content-Type: "application/json"    <---- note the addition of "

{
  "name": "Fred Jones",
  "eyes": "Blue"
}
于 2013-12-02T16:34:19.887 に答える