Skip to content

Commit

Permalink
Add immutable directive for vsn requests (#1205)
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherzxx committed Jan 22, 2024
1 parent 2eda506 commit 85f0349
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/plug/static.ex
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ defmodule Plug.Static do
%{
encodings: encodings,
only_rules: {Keyword.get(opts, :only, []), Keyword.get(opts, :only_matching, [])},
qs_cache: Keyword.get(opts, :cache_control_for_vsn_requests, "public, max-age=31536000"),
qs_cache: Keyword.get(opts, :cache_control_for_vsn_requests, "public, max-age=31536000, immutable"),
et_cache: Keyword.get(opts, :cache_control_for_etags, "public"),
et_generation: Keyword.get(opts, :etag_generation, nil),
headers: Keyword.get(opts, :headers, %{}),
Expand Down
4 changes: 2 additions & 2 deletions test/plug/static_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ defmodule Plug.StaticTest do
assert conn.status == 200
assert conn.resp_body == "HELLO"
assert get_resp_header(conn, "content-type") == ["text/plain"]
assert get_resp_header(conn, "cache-control") == ["public, max-age=31536000"]
assert get_resp_header(conn, "cache-control") == ["public, max-age=31536000, immutable"]
assert get_resp_header(conn, "etag") == []
assert get_resp_header(conn, "x-custom") == ["x-value"]
end
Expand Down Expand Up @@ -503,7 +503,7 @@ defmodule Plug.StaticTest do
assert get_resp_header(conn, "content-type") == ["text/plain"]
assert get_resp_header(conn, "accept-ranges") == ["bytes"]
assert get_resp_header(conn, "content-range") == ["bytes 0-1/5"]
assert get_resp_header(conn, "cache-control") == ["public, max-age=31536000"]
assert get_resp_header(conn, "cache-control") == ["public, max-age=31536000, immutable"]
assert get_resp_header(conn, "etag") == []
assert get_resp_header(conn, "x-custom") == ["x-value"]
end
Expand Down

0 comments on commit 85f0349

Please sign in to comment.