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 support for Partitioned cookie attribute #1225

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions lib/plug/conn/cookies.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ defmodule Plug.Conn.Cookies do
emit_if(Map.get(opts, :secure, false), "; secure"),
emit_if(Map.get(opts, :http_only, true), "; HttpOnly"),
emit_if(Map.get(opts, :same_site, nil), &encode_same_site/1),
emit_if(Map.get(opts, :partitioned, false), "; Partitioned"),
emit_if(opts[:extra], &["; ", &1])
])
end
Expand Down
4 changes: 4 additions & 0 deletions test/plug/conn/cookies_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ defmodule Plug.Conn.CookiesTest do
assert encode("foo", %{value: "bar", http_only: false}) == "foo=bar; path=/"
end

test "encodes with :partitioned option" do
assert encode("foo", %{value: "bar", partitioned: true}) == "foo=bar; path=/; HttpOnly; Partitioned"
end

test "encodes with :max_age" do
start = {{2012, 9, 29}, {15, 32, 10}}

Expand Down
Loading