Please sign in to comment.
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...