-
Notifications
You must be signed in to change notification settings - Fork 981
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
Accept: *
is treated as unrecognized content type.
#1009
Comments
I don't think "" is a valid I could be wrong. In any case, this logic is handled by the |
You are correct that according to the spec this is an invalid value for this header. However, I encountered this value in the wild, not out of my own folly. Our payment processor sends notifications to client servers when something happens (payment fails, subscription renews, whatever) and they have I will take this to negotiator and see what they say. If they accept the bug (pun intended) then I'll close this one. |
Sorry – I didn't mean to imply any folly. I just mean that with the fix to 937 you can treat the "*" like you treat any unknown |
And I didn't mean to imply that you did, just wanted to make it explicitly clear that the value of the header was out of my control. Your suggestion of handling at the end application means every single user of this package must implement their own special logic for Between the two, I think it makes more sense for restify to do it as it already performs these kinds of user-friendly actions, such as bundling 3rd-party modules, having several default formatters, and automatically formatting errors. |
I'm not convinced this is a common enough use case to be fixed in restify core, but, it should be relatively easy to fix the accept type as needed. Something like: server.pre(function fixAccept(req, res, next) {
if (req.headers['accept'] === '*') {
req.headers['accept'] = '*/*';
}
return next();
}); Would that work for your use case? |
That does, but it is exactly what @lukealbao recommended. While it is not an every-day occurrence, it can still happen in a production setting and when it does it is not entirely obvious what the problem might be. I think adopting a laissez faire approach here is an unfortunate idea when it could be squashed completely with minimal effort within restify itself. |
Heya @NatalieWolfe, thanks for the discussion on this so far! I'm leaning towards this becoming a section in a doc somewhere (i.e. |
Labeling this as a feature request for documentation 😄 happy to revisit the decision to not deviate from the specification. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed as stale because it has not had recent activity. |
This is the non-critical part of #1008. Basically, the
*
content type is treated as not matching any formatters and thus an empty response is sent. I would expect it to be treated the same as*/*
in that any formatter should be accepted.accept.js
test
The text was updated successfully, but these errors were encountered: