ember.js - Ember save needs headers. Doesnt seem to pass thru RESTAdapter headers function -


i need pass authorization token via header , works fine find , findquery save doesn't seem invoke header function?!

createrecord: function(store, type, record) {    var data = {};    var serializer = store.serializerfor(type.typekey);     var snapshot = record._createsnapshot();    serializer.serializeintohash(data, type, snapshot, { includeid: true });     return this.ajax(this.buildurl(type.typekey, null, record), "post", { data: data }); }, 

no call header in above restadapter

i quite add header call ... seems odd missing.

instead of overwriting store methods extend restadapter

app.applicationadapter = ds.restadapter.extend({   headers: {     'api_key': 'secret key',     'another_header': 'some header value'   } }); 

arbitrary headers can set key/value pairs on restadapter's headers property , ember data send them along each ajax request.

see http://emberjs.com/guides/models/connecting-to-an-http-server/#toc_custom-http-headers


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -