vendredi 29 avril 2016

Ember-data ie9 post requests not working

I'm using ember-data 4.2.0 and ember-ajax 2.0.1 and having trouble with ie9. I've read that ie9 uses the old XDomainRequest instead of the newer XHR request, and that it only sends blank or text/plain content-types. I have a rails api that ember-data posts to and it's working fine on Chrome, Firefox, and ie10+, but in ie9 I can see that the payload isn't sending with a json content-type, so the server is just getting a plain text string, which is doesn't recognize as a params hash expecting json data.

Someone suggested I do something like this, but it's not working for me.

export default DS.JSONAPIAdapter.extend({
  host: ENV.apiUrl,

  ajaxOptions(url, type, hash) {
    hash.contentType = 'application/json';
    hash.dataType = 'json';

    return this._super(url, type, hash);
  }
});

All of the store requests are standard this.store.create('whatever', payload) type requests.

Ember's docs say it supports ie9 in ember 2+, so I assumed this would work out of the box. Am I missing something to make this work?




Aucun commentaire:

Enregistrer un commentaire