WebRequest - Fix use_proxy: no on module options (#68603)
* WebRequest - Fix use_proxy: no on module options * Fix up changelog fragment
This commit is contained in:
parent
e785bdaa5b
commit
ae1cd27b57
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- 'Ansible.ModuleUtils.WebRequest - actually set no proxy when ``use_proxy: no`` is set on a Windows module - https://github.com/ansible/ansible/issues/68528'
|
|
@ -272,10 +272,10 @@ Function Get-AnsibleWebRequest {
|
|||
} else {
|
||||
$proxy.Credentials = $null
|
||||
}
|
||||
|
||||
$web_request.Proxy = $proxy
|
||||
}
|
||||
|
||||
$web_request.Proxy = $proxy
|
||||
|
||||
# Some parameters only apply when dealing with a HttpWebRequest
|
||||
if ($web_request -is [System.Net.HttpWebRequest]) {
|
||||
if ($Headers) {
|
||||
|
|
|
@ -436,6 +436,25 @@ $tests = [Ordered]@{
|
|||
} | ConvertFrom-Json
|
||||
$actual.headers.'User-Agent' | Assert-Equals -Expected 'actual-agent'
|
||||
}
|
||||
|
||||
'Web request with default proxy' = {
|
||||
$params = @{
|
||||
Uri = "https://$httpbin_host/get"
|
||||
}
|
||||
$r = Get-AnsibleWebRequest @params
|
||||
|
||||
$null -ne $r.Proxy | Assert-Equals -Expected $true
|
||||
}
|
||||
|
||||
'Web request with no proxy' = {
|
||||
$params = @{
|
||||
Uri = "https://$httpbin_host/get"
|
||||
UseProxy = $false
|
||||
}
|
||||
$r = Get-AnsibleWebRequest @params
|
||||
|
||||
$null -eq $r.Proxy | Assert-Equals -Expected $true
|
||||
}
|
||||
}
|
||||
|
||||
# setup and teardown should favour native tools to create and delete the service and not the util we are testing.
|
||||
|
|
Loading…
Reference in New Issue