loopback-component-jsonapi icon indicating copy to clipboard operation
loopback-component-jsonapi copied to clipboard

Submit PR to strong-remoting to add support for application/vnd.api+json

Open digitalsadhu opened this issue 10 years ago • 3 comments

Should be a very simple change. Just need to add a case to switch statement that falls through to json.

See discussion here: https://github.com/strongloop/loopback/issues/445#issuecomment-150923129

TODO:

  • [ ] Make sure components loopback/strong-remoting dependency up to v2.22.1
  • [ ] Remove explicit setting of Content-Type: application/vnd.api+json in various places in the component
  • [ ] Add README documentation that it is necessary to set Accept: application/vnd.api+json when using this component and that doing so will result in Content-Type: application/vnd.api+json being set on the response
  • [ ] Ensure tests pass
  • [ ] Manually test that this works

digitalsadhu avatar Oct 26 '15 18:10 digitalsadhu

PR submitted here: https://github.com/strongloop/strong-remoting/pull/249

digitalsadhu avatar Oct 26 '15 21:10 digitalsadhu

PR Accepted, waiting for merge. We should be able to remove setting the application/vnd.api+json response header once the PR is accepted.

digitalsadhu avatar Oct 28 '15 19:10 digitalsadhu

Ok all merged.

What this means: So long as strong remoting is at v2.22.1 or greater, it should now be possible to set the header:

"Accept": "application/vnd.api+json"

and the response header:

"Content-Type": "application/vnd.api+json"

will automatically be set so long as application/vnd.api+json is in the list of supported types. See: https://docs.strongloop.com/display/public/LB/config.json

List of content types that the API supports in HTTP responses. The response type will match that specfied in the HTTP request "accepts" header, if it is in this list of supported types. If this property is set, then rest.xml is ignored.

digitalsadhu avatar Nov 01 '15 10:11 digitalsadhu