当我尝试从我的API调用GET /dev/get-comments
端点时遇到错误。现在,我的API可以正常工作了,因为我的另一个GET /dev/get-posts
端点工作正常,两者之间的唯一区别是第一个端点使用了请求正文。
API.get("holler-api", "/get-comments", {
body: {postId: this.props.post.postId}
}).then(result => {
if(result.Count > 0) {
this.setState({
comments: result.Items
});
}
})
.catch(err => console.log(err));
XHR GET https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/get-comments
[HTTP/2 403 Forbidden 23ms]
这是解释错误的请求响应,不是很有帮助!
SyntaxError: JSON.parse: bad control character in string literal at line 1 column 191 of the JSON data
{"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
The Canonical String for this request should have been
'GET
/dev/get-comments
答案 0 :(得分:0)