我使用AngularJS
的$http
服务通过LeanCloud
的REST 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
的问题,好纠结。
过去多啦不再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.