documentcloud/backbone — Issue #833: Non-GET Sync requests should default to 'application/json' content-type
Author: jayred
Created: 2011-12-31 20:30:59+00:00
State: open

For consistency, all non-GET requests handled by Backbone.sync should use the 'application/json' content-type. Right now, Backbone does this for PUT and POST (i.e. 'create' and 'update') but not for DELETE ('destroy'). This is important as the developer may modify the DELETE request data to be non-null (either through options.data or using $.ajaxSend) and expect that they can pass in JSON data.

An example case of where this is applicable is when using Rails' authenticity token for non-GET requests to protect against forgery that modifies a user's data on the server.