DS.RESTAdapter#headers

headers{Object}

Defined in addon/adapters/rest.js:384

Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary headers can be set as key/value pairs on the RESTAdapter's headers object and Ember Data will send them along with each ajax request. For dynamic headers see headers customization.

app/adapters/application.js
import DS from 'ember-data';

export default DS.RESTAdapter.extend({
  headers: {
    "API_KEY": "secret key",
    "ANOTHER_HEADER": "Some header value"
  }
});
doc_EmberJs
2016-11-30 16:50:30
Comments
Leave a Comment

Please login to continue.