Skip to content
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

Add quotes to etags #220

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add quotes to etags
Etags must be quoted (reference: RFC 9110 §8.8.3)
Before:  etag: fa74dbac
After:   etag: "fa74dbac"
  • Loading branch information
zarqman committed Nov 20, 2024
commit decb334d8ce15be88dd16be31ae8f1b608cd01fa
2 changes: 1 addition & 1 deletion lib/propshaft/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def call(env)
Rack::CONTENT_LENGTH => compiled_content.length.to_s,
Rack::CONTENT_TYPE => asset.content_type.to_s,
VARY => "Accept-Encoding",
Rack::ETAG => asset.digest,
Rack::ETAG => "\"#{asset.digest}\"",
Rack::CACHE_CONTROL => "public, max-age=31536000, immutable"
},
[ compiled_content ]
Expand Down
2 changes: 1 addition & 1 deletion test/propshaft/server_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Propshaft::ServerTest < ActiveSupport::TestCase
assert_equal "62", last_response.headers['content-length']
assert_equal "text/css", last_response.headers['content-type']
assert_equal "Accept-Encoding", last_response.headers['vary']
assert_equal asset.digest, last_response.headers['etag']
assert_equal "\"#{asset.digest}\"", last_response.headers['etag']
assert_equal "public, max-age=31536000, immutable", last_response.headers['cache-control']
assert_equal ".hero { background: url(\"/foobar/source/file-3e6a1297.jpg\") }\n",
last_response.body
Expand Down