jakubrohleder / angular-jsonapi

Simple and lightweight, yet powerful ORM for your frontend that seamlessly integrates with your JsonAPI server.
http://jakubrohleder.github.io/angular-jsonapi/
GNU General Public License v3.0
95 stars 34 forks source link

Setting custom headers #30

Closed mustela closed 8 years ago

mustela commented 8 years ago

As far I can see, it is not possible to set a custom header for the resources calls, right? If not, is there any workaround?

Thanks!

guilleva commented 8 years ago

I didn't find a way to do it through angular-jsonapi, but this is how I did it:

$http.defaults.headers.common['X-API-TOKEN'] = 'XXXXXXXX'
$http.defaults.headers.common['Accept'] = 'application/vnd.api+json'
$http.defaults.headers.post['Content-Type'] = 'application/vnd.api+json'
$http.defaults.headers.put['Content-Type'] = 'application/vnd.api+json'

More info

mustela commented 8 years ago

Thanks! I did the same thing.