Issue #19575: Adding Dest Param to win_uri (#19577)

* 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
pull/19836/merge
Corwin Brown 8 years ago committed by Matt Davis
parent b7780ca530
commit 9b7c9931db

@ -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…
Cancel
Save