Created
December 17, 2013 05:22
-
-
Save Layzie/8000427 to your computer and use it in GitHub Desktop.
`beforeSend` was changed at Zepto1.1.1. So `Backbone.sync` is now broken.
This patch will fix, maybe. see https://github.com/madrobby/zepto/issues/878
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/backbone.js b/backbone.js | |
index 2171292..fd83e56 100644 | |
--- a/backbone.js | |
+++ b/backbone.js | |
@@ -1162,8 +1162,12 @@ | |
params.type = 'POST'; | |
if (options.emulateJSON) params.data._method = type; | |
var beforeSend = options.beforeSend; | |
- options.beforeSend = function(xhr) { | |
- xhr.setRequestHeader('X-HTTP-Method-Override', type); | |
+ options.beforeSend = function(xhr, settings) { | |
+ if (settings && settings.headers) { | |
+ settings.headers['X-HTTP-Method-Override'] = type; | |
+ } else { | |
+ xhr.setRequestHeader('X-HTTP-Method-Override', type); | |
+ } | |
if (beforeSend) return beforeSend.apply(this, arguments); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This problem has been fixed at this commit in zepto.