mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Handle duplicate headers in the uri module (#33792)
* Handle duplicate headers, and make it easier for users to use cookies, by providing a pre-built string * Ensure proper cookie ordering, make key plural * Add note about cookie sort order * Add tests for duplicate headers and cookies_string * Extend tests, normalize headers between py2 and py3 * Add some notes in test code * Don't use AttributeError, use six.PY3. Use better names.
This commit is contained in:
parent
f1082af73f
commit
450cfa8776
3 changed files with 55 additions and 2 deletions
|
@ -375,6 +375,17 @@
|
|||
failed_when: result is not failed
|
||||
when: has_httptester
|
||||
|
||||
- uri:
|
||||
url: https://{{ httpbin_host }}/response-headers?Set-Cookie=Foo%3Dbar&Set-Cookie=Baz%3Dqux
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result['set_cookie'] == 'Foo=bar, Baz=qux'
|
||||
# Python sorts cookies in order of most specific (ie. longest) path first
|
||||
# items with the same path are reversed from response order
|
||||
- result['cookies_string'] == 'Baz=qux; Foo=bar'
|
||||
|
||||
- name: Write out netrc template
|
||||
template:
|
||||
src: netrc.j2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue