-
Notifications
You must be signed in to change notification settings - Fork 208
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
Is it possible to return a Dancer::Response that is left unchanged? #1211
Comments
Does it work if you set the desired charset yourself? RFC 7231 says:
So, while that's a SHOULD not a MUST, it's still recommended practice to have a correct charset. |
Well, I kind of agree. Sigh, I'm trying to implement JSON API v1 (https://jsonapi.org/format/#content-negotiation-servers), and they require the Content-Type to be only "application/vnd.api+json" without any additional parameters. Their answer Be that as it may, why not simply trust a |
I think setting a default value if the user didn't specify one themselves is more correct in the majority of cases, for DWIMmery and concise code, and is going to be helpful far more often than it would be a hinderance. I'm torn here; if you return a Dancer::Response object yourself, it's fairly clear that you know what you're doing and you wish to override a lot of Dancer's helpfulness and just say "here, just use this response". On the other hand, it's a change which could surprise anyone who was returning a response object for any reason but expecting the previous behaviour. I shall have a think :) |
well, returning a Dancer::Response is not documented for the moment, so I do not think that anyone is expecting anything. Does send_file return a Dancer::Response? That would complicate things.. You can always add a flag |
I'm trying to make Dancer accept my response, and leave it unchanged.
I've used
send_file
, and alsoDancer::Response
, but when theresponse has text like content, it tries to reencode it, and adds charset
to the header content-type. Returning a Dancer::Response with the flag
"encoded" on, fixes the problem with reencoding, but still adds the charset.
Any idea?
The text was updated successfully, but these errors were encountered: