Backbone destroy method is triggering post call instead of delete when type: “DELETE”, is not passed

删除回忆录丶 提交于 2019-12-24 11:17:53

问题


     var asset = Backbone.Model.extend({
                      urlRoot: 'https://www.example.com/asset/',
                      idAttribute: "assetId",
                 });

     var k = new asset({"assetId":11174355100070});


     k.destroy({
                 headers : { 
                            'Authorization': 'OAuth ' + oauthInfo.oa2,
                            'GSID' : oauthInfo.GSID
                 },
                 contentType: "application/json",
                 success: function(){console.log("success method")},
                 error: function(){console.log("failure error")}
      });

Why is the backbone destroy method triggering the post call instead of delete?

But when type: "DELETE" is passed it is working? Am I missing anything? Why should one pass type when destroy is especially for delete operation.

来源:https://stackoverflow.com/questions/52069982/backbone-destroy-method-is-triggering-post-call-instead-of-delete-when-type-de

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!