Allow to force custom headers for responses that shouldn't include them #132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
According to RFC 2616, when a response MUST have an empty body, it only allows Entity Headers.
For instance, a 204 doesn't allow Content-Type or any other custom header.
This restriction is enforced by Lotus::Action::Head#finish.
However, there are cases that demand to bypass this rule to set meta
informations via headers.
An example is a DELETE request for a JSON API application. It returns a 204 but still wants to specify the rate limit quota via X-Rate-Limit.
Only the following headers will be sent:
Last-Modified- because we used `super' in the method that respects the HTTP RFCX-Rate-Limit- because we explicitely allow itBoth
Content-TypeandX-No-Passare removed because they're not allowedIf there are no objections, I would release
v0.4.6with only this change, because needed by a project I'm working on./cc @lotus/core-team