Skip to content

Commit

Permalink
Merge pull request #1705 from pgjones/samesite
Browse files Browse the repository at this point in the history
Add samesite cookie support to test client
  • Loading branch information
davidism committed Jan 27, 2020
2 parents f6a6234 + 852c4e6 commit 5e370db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Unreleased
such that ``X-Foo`` is the same as ``x-foo``. :pr:`1605`
- :meth:`http.dump_cookie` accepts ``'None'`` as a value for
``samesite``. :issue:`1549`
- :meth:`~test.Client.set_cookie` accepts a ``samesite`` argument.
:pr:`1705`
- Support the Content Security Policy header through the
`Response.content_security_policy` data structure. :pr:`1617`
- ``LanguageAccept`` will fall back to matching "en" for "en-US" or
Expand Down
12 changes: 11 additions & 1 deletion src/werkzeug/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ def set_cookie(
domain=None,
secure=None,
httponly=False,
samesite=None,
charset="utf-8",
):
"""Sets a cookie in the client's cookie jar. The server name
Expand All @@ -832,7 +833,16 @@ def set_cookie(
"""
assert self.cookie_jar is not None, "cookies disabled"
header = dump_cookie(
key, value, max_age, expires, path, domain, secure, httponly, charset
key,
value,
max_age,
expires,
path,
domain,
secure,
httponly,
charset,
samesite=samesite,
)
environ = create_environ(path, base_url="http://" + server_name)
headers = [("Set-Cookie", header)]
Expand Down

0 comments on commit 5e370db

Please sign in to comment.