Backbone destroy method is triggering post call in

2019-08-03 15:14发布

问题:

     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.