Last active
December 18, 2015 14:19
-
-
Save marcoow/5796449 to your computer and use it in GitHub Desktop.
custom REST adapter for ember-data that sends the authentication token in a header
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
App.AuthenticatedRESTAdapter = DS.RESTAdapter.extend({ | |
ajax: function(url, type, hash) { | |
hash = hash || {}; | |
hash.headers = hash.headers || {}; | |
hash.headers['X-AUTHENTICATION-TOKEN'] = this.authToken; | |
return this._super(url, type, hash); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After looking around a bit, it appears that the
headers
property is designed for this: