Replace httpbin.org/headers with WebListener Get (#4799)

* Replace httpbin.org/headers with WebListener Get

* [feature] -SkipCertificateCheck to avoid Cert issue

* [Feature] Rebase & Rerun CI
This commit is contained in:
Mark Kraus
2017-09-14 09:22:52 +04:00
committed by Ilya
parent 6703014b32
commit 869cdf9ba4
@@ -461,14 +461,15 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" {
It "Invoke-WebRequest returns headers dictionary" {
$command = "Invoke-WebRequest -Uri http://httpbin.org/headers -TimeoutSec 5"
$uri = Get-WebListenerUrl -Test 'Get'
$command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 5"
$result = ExecuteWebCommand -command $command
ValidateResponse -response $result
# Validate response content
$jsonContent = $result.Output.Content | ConvertFrom-Json
$jsonContent.headers.Host | Should Match "httpbin.org"
$jsonContent.headers.Host | Should Be $Uri.Authority
$jsonContent.headers.'User-Agent' | Should Match "WindowsPowerShell"
}
@@ -569,14 +570,15 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" {
# Configure the environment variable.
New-Item -Name ${name} -Value ${proxy_address} -ItemType Variable -Path Env: -Force
$command = "Invoke-WebRequest -Uri '${protocol}://httpbin.org/headers' -TimeoutSec 5 -NoProxy"
$uri = Get-WebListenerUrl -Test 'Get' -Https:$($protocol -eq 'https')
$command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 5 -NoProxy -SkipCertificateCheck"
$result = ExecuteWebCommand -command $command
ValidateResponse -response $result
# Validate response content
$jsonContent = $result.Output.Content | ConvertFrom-Json
$jsonContent.headers.Host | Should Match "httpbin.org"
$jsonContent.headers.Host | Should Be $uri.Authority
$jsonContent.headers.'User-Agent' | Should Match "WindowsPowerShell"
}
@@ -1319,12 +1321,13 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" {
It "Invoke-RestMethod returns headers dictionary" {
$command = "Invoke-RestMethod -Uri http://httpbin.org/headers -TimeoutSec 5"
$uri = Get-WebListenerUrl -Test 'Get'
$command = "Invoke-RestMethod -Uri '$uri' -TimeoutSec 5"
$result = ExecuteWebCommand -command $command
# Validate response
$result.Output.headers.Host | Should Match "httpbin.org"
$result.Output.headers.Host | Should Be $Uri.Authority
$result.Output.headers.'User-Agent' | Should Match "WindowsPowerShell"
}