Skip to content

Example of modifying the DSHttpAdapterProvider update method to use POST #158

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

Closed
bassettsj opened this issue Sep 11, 2014 · 3 comments
Closed
Labels

Comments

@bassettsj
Copy link

For whatever reason, the API I have to use will only except POST for creating resources. I was looking through the documentation to see if there was a way to change the update call to POST. Is this even possible without just simply copying all the code and changing that one line?

@jmdobry
Copy link
Member

jmdobry commented Sep 11, 2014

You can override the DSHttpAdapter.update method. If this method ever changes you'll need to update your override.

DSHttpAdapter.update = function (resourceConfig, id, attrs, options) {
  options = options || {};
  return this.POST(
    DS.utils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.getEndpoint(id, options), id),
    attrs,
    options
  );
};

@jmdobry
Copy link
Member

jmdobry commented Sep 12, 2014

Closing in favor of #161

@bassettsj
Copy link
Author

@jmdobry Thank you much. I really appreciate the help.

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

No branches or pull requests

2 participants