|
|
@ -36,6 +36,8 @@ $validate_certs = Get-AnsibleParam -obj $params -name "validate_certs" -type "bo
|
|
|
|
$client_cert = Get-AnsibleParam -obj $params -name "client_cert" -type "path"
|
|
|
|
$client_cert = Get-AnsibleParam -obj $params -name "client_cert" -type "path"
|
|
|
|
$client_cert_password = Get-AnsibleParam -obj $params -name "client_cert_password" -type "str"
|
|
|
|
$client_cert_password = Get-AnsibleParam -obj $params -name "client_cert_password" -type "str"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$JSON_CANDIDATES = @('text', 'json', 'javascript')
|
|
|
|
|
|
|
|
|
|
|
|
$result = @{
|
|
|
|
$result = @{
|
|
|
|
changed = $false
|
|
|
|
changed = $false
|
|
|
|
url = $url
|
|
|
|
url = $url
|
|
|
@ -232,8 +234,12 @@ if ($return_content -or $dest) {
|
|
|
|
$memory_st.Seek(0, [System.IO.SeekOrigin]::Begin)
|
|
|
|
$memory_st.Seek(0, [System.IO.SeekOrigin]::Begin)
|
|
|
|
$content_bytes = $memory_st.ToArray()
|
|
|
|
$content_bytes = $memory_st.ToArray()
|
|
|
|
$result.content = [System.Text.Encoding]::UTF8.GetString($content_bytes)
|
|
|
|
$result.content = [System.Text.Encoding]::UTF8.GetString($content_bytes)
|
|
|
|
if ($result.ContainsKey("content_type") -and $result.content_type -in @("application/json", "application/javascript")) {
|
|
|
|
if ($result.ContainsKey("content_type") -and $result.content_type -Match ($JSON_CANDIDATES -join '|')) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
$result.json = ConvertFrom-Json -InputObject $result.content
|
|
|
|
$result.json = ConvertFrom-Json -InputObject $result.content
|
|
|
|
|
|
|
|
} catch [System.ArgumentException] {
|
|
|
|
|
|
|
|
# Simply continue, since 'text' might be anything
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|