Dart通过端点将JSON发布到Google应用程序引擎

Dart通过端点将JSON发布到Google应用程序引擎,json,google-app-engine,dart,Json,Google App Engine,Dart,有人知道为什么我在发布到应用程序引擎时总是收到错误400解析错误吗?我很好。我有JSON.encoded。以前有人遇到过这些问题吗 这是我的HTTPRequest代码 sendData=JSON.encode(数据); _httpRequest=新的httpRequest() ..打开(方法、url) ..setRequestHeader(“授权”、“承载人”+令牌密钥) …onLoadEnd.listen((e)=>_loadEnd(_httpRequest)) ..发送(发送数据); 不要忘

有人知道为什么我在发布到应用程序引擎时总是收到错误400解析错误吗?我很好。我有JSON.encoded。以前有人遇到过这些问题吗

这是我的HTTPRequest代码

sendData=JSON.encode(数据);
_httpRequest=新的httpRequest()
..打开(方法、url)
..setRequestHeader(“授权”、“承载人”+令牌密钥)
…onLoadEnd.listen((e)=>_loadEnd(_httpRequest))
..发送(发送数据);

不要忘记将标题指定为内容类型:application/json,因为如果没有它,数据是text/html。愚蠢的错误

此处更新帖子:


sendData=JSON.encode(数据)

_httpRequest=新的httpRequest() ..打开(方法、url) ..setRequestHeader(“授权”、“承载人”+令牌密钥) ..setRequestHeader(“内容类型”、“应用程序/json”) …onLoadEnd.listen((e)=>_loadEnd(_httpRequest)) ..重写emimetype(“应用程序/json”) ..发送(发送数据);

您查看了关于的评论了吗?谢谢您的参考。