loopback-component-jsonapi
loopback-component-jsonapi copied to clipboard
Submit PR to strong-remoting to add support for application/vnd.api+json
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+jsonin various places in the component - [ ] Add README documentation that it is necessary to set
Accept: application/vnd.api+jsonwhen using this component and that doing so will result inContent-Type: application/vnd.api+jsonbeing set on the response - [ ] Ensure tests pass
- [ ] Manually test that this works
PR submitted here: https://github.com/strongloop/strong-remoting/pull/249
PR Accepted, waiting for merge. We should be able to remove setting the application/vnd.api+json response header once the PR is accepted.
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.