@@ -587,8 +587,8 @@ Describe "Invoke-WebRequest tests" -Tags "Feature", "RequireAdminOnWindows" {
587
587
# $dataEncodings = @("Chunked", "Compress", "Deflate", "GZip", "Identity")
588
588
# Note: These are the supported options, but we do not have a web service to test them all.
589
589
It " Invoke-WebRequest supports request that returns <DataEncoding>-encoded data." - TestCases @ (
590
- @ { DataEncoding = " gzip" }
591
- @ { DataEncoding = " deflate" }
590
+ @ { DataEncoding = " gzip" }
591
+ @ { DataEncoding = " deflate" }
592
592
) {
593
593
param ($dataEncoding )
594
594
$uri = Get-WebListenerUrl - Test ' Compression' - TestValue $dataEncoding
@@ -598,7 +598,7 @@ Describe "Invoke-WebRequest tests" -Tags "Feature", "RequireAdminOnWindows" {
598
598
ValidateResponse - response $result
599
599
600
600
# Validate response content
601
- $result .Output.Headers . ' Content-Encoding ' [ 0 ] | Should - BeExactly $dataEncoding
601
+ # The content should be de-compressed, and otherwise converting from JSON will fail.
602
602
$jsonContent = $result.Output.Content | ConvertFrom-Json
603
603
$jsonContent.Headers.Host | Should - BeExactly $uri.Authority
604
604
}
@@ -2246,15 +2246,15 @@ Describe "Invoke-RestMethod tests" -Tags "Feature", "RequireAdminOnWindows" {
2246
2246
# $dataEncodings = @("Chunked", "Compress", "Deflate", "GZip", "Identity")
2247
2247
# Note: These are the supported options, but we do not have a web service to test them all.
2248
2248
It " Invoke-RestMethod supports request that returns <DataEncoding>-encoded data." - TestCases @ (
2249
- @ { DataEncoding = " gzip" }
2250
- @ { DataEncoding = " deflate" }
2249
+ @ { DataEncoding = " gzip" }
2250
+ @ { DataEncoding = " deflate" }
2251
2251
) {
2252
2252
param ($dataEncoding )
2253
2253
$uri = Get-WebListenerUrl - Test ' Compression' - TestValue $dataEncoding
2254
- $result = Invoke-RestMethod - Uri $uri - ResponseHeadersVariable ' headers '
2254
+ $result = Invoke-RestMethod - Uri $uri
2255
2255
2256
2256
# Validate response content
2257
- $headers . ' Content-Encoding ' [ 0 ] | Should - BeExactly $dataEncoding
2257
+ # The content should be de-compressed. Otherwise, the above 'Invoke-RestMethod' would have thrown because converting to JSON internally would fail.
2258
2258
$result.Headers.Host | Should - BeExactly $uri.Authority
2259
2259
}
2260
2260
0 commit comments