Backbone model.save() is causing POST not PUT

后端 未结 5 597
天涯浪人
天涯浪人 2021-01-12 13:35

I have a Backbone model:

var User = Backbone.Model.extend({
  idAttribute: \'_id\',

  url: \'/api/user\',

  defaults:
    { username: \'\'
    }
});
         


        
5条回答
  •  北恋
    北恋 (楼主)
    2021-01-12 13:59

    It may be worth checking if maybe emulateHTTP is true. This will change all your PUT into POST with an added _method header (you may also want to check that this exists to confirm the idea).

提交回复
热议问题