documentcloud/backbone — pull request #1143 by justinperkins (2012-03-26 08:09:30+00:00)
Title: stringify the data passed into sync

I made this change because my backend understood a JSON POST body, but had some awkwardness in the API that required using my own sync methods in some models/collections (but still ultimately calling Backbone's sync). I was constantly setting the data collection to JSON, but due to Backbone not stringifying or setting the header correctly when the callee passed in data, I had code all over the place that was doing the same thing again and again.

It seems like Backbone's sync could be a little nicer by stringifying the passed in data and setting the header correctly even for those who want to send in their own data.