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

Feature/agcmd 45 #3

Merged
merged 5 commits into from
Nov 11, 2015
Merged

Feature/agcmd 45 #3

merged 5 commits into from
Nov 11, 2015

Conversation

ShurakaiSoft
Copy link
Contributor

Added some basic global error handling that is JSON API compliant.

if (response.isBoom) {
response.output = response.output || {}
response.output.headers = response.output.headers || {}
response.output.headers['content-type'] = 'application/vnd.api+json'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need need to specify the content type here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content-type is not set anywhere else and it should be set to 'application/vnd.api+json' as per the JSON API spec. This was the only way to get it to work. reply.header(...) isn't a function on this reply object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not then be outside response.isBoom as we want to set it everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. I'm not sure if there is a case where we don't want to return 'application/vnd.api+json'. If absolutely everything should be 'application/vnd.api+json' then it would make sense to set that once globally, and perhaps override the new default if and when necessary.

@mavdi
Copy link
Contributor

mavdi commented Nov 9, 2015

@ShurakaiSoft This ones turns now but sadly it's conflicting with the code Bernard wrote, I think you just need to merge your onPostResponse code with his

mavdi added a commit that referenced this pull request Nov 11, 2015
@mavdi mavdi merged commit 8d8952b into master Nov 11, 2015
@mavdi mavdi deleted the feature/AGCMD-45 branch November 11, 2015 13:23
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.

2 participants