uri: Document cookies_string, cookies and content (#66612)

The example with set_cookie value in cookie header can fail if the server
has set many cookies. The set_cookie value is the cookies sent by server in
set-cookie header, not what the client should send in cookie header to
server.

#33792 introduced cookies_string to solve the problem, but did not update
the uri module example.

content and cookies were also missing from RETURN.
This commit is contained in:
Marko Kohtala 2020-01-28 17:59:29 +02:00 committed by ansibot
parent 365f2aaed1
commit d385a648c4

View file

@ -237,7 +237,7 @@ EXAMPLES = r'''
method: GET method: GET
return_content: yes return_content: yes
headers: headers:
Cookie: "{{ login.set_cookie }}" Cookie: "{{ login.cookies_string }}"
- name: Queue build of a project in Jenkins - name: Queue build of a project in Jenkins
uri: uri:
@ -313,28 +313,45 @@ EXAMPLES = r'''
RETURN = r''' RETURN = r'''
# The return information includes all the HTTP headers in lower-case. # The return information includes all the HTTP headers in lower-case.
content:
description: The response body content.
returned: status not in status_code or return_content is true
type: str
sample: "{}"
cookies:
description: The cookie values placed in cookie jar.
returned: on success
type: dict
sample: {"SESSIONID": "[SESSIONID]"}
version_added: "2.4"
cookies_string:
description: The value for future request Cookie headers.
returned: on success
type: str
sample: "SESSIONID=[SESSIONID]"
version_added: "2.6"
elapsed: elapsed:
description: The number of seconds that elapsed while performing the download description: The number of seconds that elapsed while performing the download.
returned: on success returned: on success
type: int type: int
sample: 23 sample: 23
msg: msg:
description: The HTTP message from the request description: The HTTP message from the request.
returned: always returned: always
type: str type: str
sample: OK (unknown bytes) sample: OK (unknown bytes)
redirected: redirected:
description: Whether the request was redirected description: Whether the request was redirected.
returned: on success returned: on success
type: bool type: bool
sample: false sample: false
status: status:
description: The HTTP status code from the request description: The HTTP status code from the request.
returned: always returned: always
type: int type: int
sample: 200 sample: 200
url: url:
description: The actual URL used for the request description: The actual URL used for the request.
returned: always returned: always
type: str type: str
sample: https://www.ansible.com/ sample: https://www.ansible.com/