Home  >  Q&A  >  body text

angular.js - LeanCloud Rest API

我使用AngularJS$http服务通过LeanCloudREST API对数据进行存储时发现可以存储数据,但是不能够删除数据,使用$http.delete()时看到控制台报错信息是:Method DELETE is not allowed by Access-Control-Allow-Methods.,但是使用LeanCloud官网上面的REST API在线测试工具是可以的。直接通过Git Bash发送请求也是可以的,如下:

curl -X DELETE \
-H "X-AVOSCloud-Application-Id: *********************" \
-H "X-AVOSCloud-Application-Key: *********************" \
https://api.leancloud.cn/1.1/classes/GameScore/51e3a334e4b0b3eb44adbe1...

不知道哪里出现问题,是AngularJS的问题,还是LeanCloud的问题,好纠结。

阿神阿神2737 days ago550

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-15 16:55:01

    You need to open the browser console and confirm whether the X-AVOSCloud-Application-Id and X-AVOSCloud-Application-Key parameters in the HTTP Header are correct. You can refer to the data management page of the console to perform related operations and then view the network request format. This is also implemented through angular. It should have nothing to do with angular itself.

    reply
    0
  • Cancelreply