Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix duplicate Content-Type header with Rack 2
Previously, `ActionDispatch::Static` would always merge a "content-type" header into the headers returned from `Rack::Files`. However, this would potentially lead to both a "Content-Type" header and a "content-type" header when using Rack 2. This commit fixes the issue by using `Rack::CONTENT_TYPE` to determine which version of the header to set in `ActionDispatch::Static`. In both versions of Rack it will use the same version of the header as `Rack::Files`. The tests added have to use `@app.call` instead of `get()`/`Rack::MockRequest` because `Rack::Response` actually does the correct thing already by using `Rack::Util::HeaderHash` so it covers up the issue in tests.
- Loading branch information