You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To support Rack 3, response headers in `Sprockets::Server` were all
downcased. However, this has led to issues with Rack 2 applications (ex.
Rails 7) since they still expect mixed case (ex. `Content-Type`)
headers.
To ensure compatibility with both Rack 2 and Rack 3 applications, this
commit makes the casing of the headers conditional on the Rack version.
Rack itself provides constants to do this easily for most of the headers
used (`Content-Type`, `Content-Length`, `Cache-Control`, and `ETag`) and
the rest are added as constants under `Rack::Server`.
As an alternative to this, the responses could instead be wrapped using
`Rack::Headers` (and `Rack::Utils::HeaderHash` in Rack 2), but making
the header casing conditional seems better to me because it is
relatively easier to implement and there will be less churn if/when Rack
2 support is eventually removed.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md
4
4
5
5
- Fix for precompile issues when multiple extensions map to the same MIME type (eg. `.jpeg` / `.jpg`). [#781](https://github.com/rails/sprockets/pull/781)
6
+
- Fix compatibility with Rack 2 applications. [#790](https://github.com/rails/sprockets/pull/790)
0 commit comments