-
Notifications
You must be signed in to change notification settings - Fork 983
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
No parameter support in Content-Type and Accept Header #528
Comments
Looks like we are using a more recent version of negotiator now, than when this was filed. @awenger can you confirm that this is still a problem? |
This is still impossible with the recent version @micahr . However the source of the problem is different this time. Negotiator seems to negotiate the content-type by also checking the parameter of the content type (
However restify strips the param part and passes only This also leads to restify listing
[1] https://github.com/jshttp/negotiator/blob/master/lib/mediaType.js#L106 Lines 87 to 94 in 4e38bd7
|
Thank you for confirming that this is still an issue. I'll get it on our list for the next release. |
Thank you for your effort. I'm not 100% sure whether it's a good idea to enforce matching content type parameters during content negotiation. This is what the spec says about it:
What do you think @micahr [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 |
I think we shouldn't be using parameters when matching content-type as they are meant as additional metadata. It would be better to match against the root content-type (application/vnd.test+json in this case) and then allow the consumer to use the parameters to further determine actions needed for a given route. |
Sounds good. This is also what I had in mind. But in this case I guess we have to fix it in Negotiator, or did I miss something? |
I think we should strip the params before sending the content types for comparison to negotiator. |
Hi. Restify version 4.0.3 on Node 4.0.0 Update: |
Closing this in favor of #1219 Please correct me if I'm missing a nuance ❤️ |
Hey @rzio, I know this was from back in 2015, but if you are still experiencing this problem please open an issue with a repro case and we will tackle it! |
It's impossible to use parameterized [1] Content-Type and Accept Headers
curl http://localhost:5000/test/1 -H 'Accept: application/vnd.test+json;param=myparam'
Causes the following error:
{"code":"NotAcceptableError","message":"Server accepts: application/vnd.test+json,application/json,text/plain,application/octet-stream,application/javascript"}
Replacing negotiator with the current version (0.4.1) fixes this problem:
custom formatter called
{"a":1,"b":2}
Is there a possibility to set a parameterized Content-Type in the response?
The Content-Type is truncated to
application/vnd.test+json
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
The text was updated successfully, but these errors were encountered: