-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
xhr.setRequestHeader()
in Ajax beforeSend
I broke this in 23d1879, where I promised to make more Ajax settings configurable in `beforeSend`. However, it drifted away from jQuery compatibility. In both jQuery 1.10 and 2.0, the state in `beforeSend` is: - `settings.data` is `undefined` for GET requests, as it was already serialized and added as query params to the URL. - `settings.headers` is `undefined` if an object was not originally specified in the request, but otherwise adding or changing the values in it has no effect. This might be a jQuery bug, since its documentatation clearly indicates that you should be able to add/change header values this way. - `xhr.setRequestHeader()` is available, although technically `xhr.open()` hasn't been called yet. Since the native `setRequestHeader()` can't be called before `open()`, I replaced it with our custom method that collects the header values until they're ready to be applied to the XHR object. Fixes #878
- Loading branch information
Showing
2 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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