mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Make web cmdlets skip processing the content headers with a null or empty value for backward compatibility (#11421)
This commit is contained in:
1 parent
7658af4532
commit
1376d310bb
2 files changed
+34
-11
No files matched your search
@@ -447,6 +447,16 @@ Describe "Invoke-WebRequest tests" -Tags "Feature", "RequireAdminOnWindows" {
|
||||
$jsonContent.headers.Host | Should -Be $Uri.Authority
|
||||
}
|
||||
|
||||
It "Invoke-WebRequest with blank ContentType succeeds" {
|
||||
$uri = Get-WebListenerUrl -Test 'Get'
|
||||
$command = "Invoke-WebRequest -Uri '$uri' -ContentType ''"
|
||||
|
||||
$result = ExecuteWebCommand -command $command
|
||||
|
||||
# Validate response
|
||||
ValidateResponse -response $result
|
||||
}
|
||||
|
||||
It "Validate Invoke-WebRequest -DisableKeepAlive" {
|
||||
# Operation options
|
||||
$uri = Get-WebListenerUrl -Test 'Get'
|
||||
@@ -1995,6 +2005,16 @@ Describe "Invoke-RestMethod tests" -Tags "Feature", "RequireAdminOnWindows" {
|
||||
$result.Output.headers.'User-Agent' | Should -MatchExactly '.*\(Windows NT \d+\.\d*;.*\) PowerShell\/\d+\.\d+\.\d+.*'
|
||||
}
|
||||
|
||||
It "Invoke-RestMethod with blank ContentType succeeds" {
|
||||
$uri = Get-WebListenerUrl -Test 'Get'
|
||||
$command = "Invoke-RestMethod -Uri '$uri' -ContentType ''"
|
||||
|
||||
$result = ExecuteWebCommand -command $command
|
||||
|
||||
# Validate response
|
||||
$result.Error | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "Invoke-RestMethod returns headers dictionary" {
|
||||
$uri = Get-WebListenerUrl -Test 'Get'
|
||||
$command = "Invoke-RestMethod -Uri '$uri'"
|
||||
|
||||
Reference in new issue
Block a user