From 6036bb69d9b0225d8342173f319aac1a1323b7fd Mon Sep 17 00:00:00 2001 From: Iago Garrido Date: Mon, 7 Nov 2016 22:04:09 +0100 Subject: [PATCH] Fixes win_uri module ignoring body argument (#2504) * Fixes win_uri module ignoring body argument * Added body field of the response to the documentation --- lib/ansible/modules/extras/windows/win_uri.ps1 | 5 +++++ lib/ansible/modules/extras/windows/win_uri.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/ansible/modules/extras/windows/win_uri.ps1 b/lib/ansible/modules/extras/windows/win_uri.ps1 index b02418e8912..d701ef56b92 100644 --- a/lib/ansible/modules/extras/windows/win_uri.ps1 +++ b/lib/ansible/modules/extras/windows/win_uri.ps1 @@ -65,6 +65,11 @@ if ($headers -ne $null) { $webrequest_opts.Headers = $req_headers } +if ($body -ne $null) { + $webrequest_opts.Body = $body + Set-Attr $result.win_uri "body" $body +} + try { $response = Invoke-WebRequest @webrequest_opts } catch { diff --git a/lib/ansible/modules/extras/windows/win_uri.py b/lib/ansible/modules/extras/windows/win_uri.py index 7045f70bd42..c65f3ab536a 100644 --- a/lib/ansible/modules/extras/windows/win_uri.py +++ b/lib/ansible/modules/extras/windows/win_uri.py @@ -120,6 +120,11 @@ use_basic_parsing: returned: always type: bool sample: True +body: + description: The content of the body used (added in version 2.2) + returned: when body is specified + type: string + sample: '{"id":1}' status_code: description: The HTTP Status Code of the response. returned: success