Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: IE11 compatibility of JSONAPI adapter #3675

Closed
wants to merge 1 commit into from
Closed

Fix: IE11 compatibility of JSONAPI adapter #3675

wants to merge 1 commit into from

Conversation

spieker
Copy link

@spieker spieker commented Aug 19, 2015

I know that the JSON API spec uses the PATCH method for updating a record. Since the IE is still not supporting the PATCH method, I suggest to use the PUT method instead of PATCH but giving the user the ability to change this behaviour by setting a property on the ApplicationAdapter.

In this pull request I have introduced the property patchMethod which is set to PUT by default.

What do you think, is this a suitable way to deal with this problem?

@wecc
Copy link
Contributor

wecc commented Aug 19, 2015

Since the IE is still not supporting the PATCH method

From what I've read IE does support PATCH (under the correct circumstances) and in this case it's probably more of a jQuery issue (switching between XHR and ActiveX) than a IE issue. PATCH seem to be working find in IE using the jQuery Compat Edge branch.

We do not want PUT as a default since that would not only break people's apps but also make our default implementation not follow the JSON API specification.

I know @pangratz has been working on making it easier to override and customize the HTTP verb for all AJAX calls made by Ember Data. I think that's a better approach to solve this than a specific override just for the PATCH request in JSONAPIAdapter.

@pangratz
Copy link
Member

Yep, the PR is at #3099. I try to find some time in the evening to rebase the PR onto latest master...

@spieker
Copy link
Author

spieker commented Aug 19, 2015

I see your point.

If others run into the same problem, this is how we solved it for now

ApplicationAdapter = DS.JSONAPIAdapter.extend({
  ajax: function(url, type, options) {
    if (type === 'PATCH') {
      type = 'PUT';
    }
    return this._super(url, type, options);
  }
});

@bmac
Copy link
Member

bmac commented Oct 12, 2015

Hi @spieker. I'm going to close this pr as the Ember Data team would like the defaults to encourage users to follow the JSON API spec. If users need to use "PUT" they can override the ApplicationAdapter as you have shown in your example.

Feel free to re-open this issue if I'm missing something.

@bmac bmac closed this Oct 12, 2015
@spieker
Copy link
Author

spieker commented Oct 12, 2015

It's fine, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants