-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
if (response.isBoom) { | ||
response.output = response.output || {} | ||
response.output.headers = response.output.headers || {} | ||
response.output.headers['content-type'] = 'application/vnd.api+json' |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@ShurakaiSoft This ones turns now but sadly it's conflicting with the code Bernard wrote, I think you just need to merge your |
Added some basic global error handling that is JSON API compliant.