mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* Issue #19575: Adding Dest Param to win_uri Added `dest` param to win_uri. Outputs the response body to a specified file. Addresses Issue #19575 * Was setting the wrong attribute
This commit is contained in:
parent
b7780ca530
commit
9b7c9931db
2 changed files with 11 additions and 0 deletions
lib/ansible/modules/windows
|
@ -42,6 +42,7 @@ $method = Get-AnsibleParam -obj $params "method" -default "GET"
|
|||
$content_type = Get-AnsibleParam -obj $params -name "content_type"
|
||||
$headers = Get-AnsibleParam -obj $params -name "headers"
|
||||
$body = Get-AnsibleParam -obj $params -name "body"
|
||||
$dest = Get-AnsibleParam -obj $params -name "dest" -default $null
|
||||
$use_basic_parsing = ConvertTo-Bool (Get-AnsibleParam -obj $params -name "use_basic_parsing" -default $true)
|
||||
|
||||
$webrequest_opts.Uri = $url
|
||||
|
@ -70,6 +71,11 @@ if ($body -ne $null) {
|
|||
Set-Attr $result.win_uri "body" $body
|
||||
}
|
||||
|
||||
if ($dest -ne $null) {
|
||||
$webrequest_opts.OutFile = $dest
|
||||
Set-Attr $result.win_uri "dest" $dest
|
||||
}
|
||||
|
||||
try {
|
||||
$response = Invoke-WebRequest @webrequest_opts
|
||||
} catch {
|
||||
|
|
|
@ -57,6 +57,11 @@ options:
|
|||
body:
|
||||
description:
|
||||
- The body of the HTTP request/response to the web service.
|
||||
dest:
|
||||
version_added: "2.3"
|
||||
description:
|
||||
- Output the response body to a file.
|
||||
default: None
|
||||
headers:
|
||||
description:
|
||||
- 'Key Value pairs for headers. Example "Host: www.somesite.com"'
|
||||
|
|
Loading…
Add table
Reference in a new issue