GyldendalDigital/jQuery-easyXDM — pull request #3 by aaronk6 (2014-05-20 08:48:05+00:00)
Title: Pass custom headers to easyXDM provider

Hey,

First of all, thanks for this useful plugin!

While integrating this in one of our client's projects, I noticed that custom headers won't get passed to the easyXDM provider. I've made a small fix to address this issue. I stumbled across this while adding a custom API authorization header which got lost when the easyXDM fallback was in use.

This is the code I'm using to add the API auth header to all jQuery AJAX requests:

$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
if (!options.headers) options.headers = {};
options.headers['X-API-Auth'] = t;
});

This header is now also transmitted when using the easyXDM fallback.

Let me know if this works for you as well or if you see any issues.

Thanks,
Aaron