@@ -759,9 +759,14 @@ Describe "Invoke-WebRequest tests" -Tags "Feature", "RequireAdminOnWindows" {
759759 ($result.Output.Content | ConvertFrom-Json ).method | Should - Be " TEST"
760760 }
761761
762- It " Validate Invoke-WebRequest default ContentType for CustomMethod POST" {
763- $uri = Get-WebListenerUrl - Test ' Post'
764- $command = " Invoke-WebRequest -Uri '$uri ' -CustomMethod POST -Body 'testparam=testvalue'"
762+ It " Validate Invoke-WebRequest default ContentType for CustomMethod <method>" - TestCases @ (
763+ @ {method = " POST" }
764+ @ {method = " PUT" }
765+ ) {
766+ param ($method )
767+
768+ $uri = Get-WebListenerUrl - Test $method
769+ $command = " Invoke-WebRequest -Uri '$uri ' -CustomMethod $method -Body 'testparam=testvalue'"
765770 $result = ExecuteWebCommand - command $command
766771 $jsonResult = $result.Output.Content | ConvertFrom-Json
767772 $jsonResult.form.testparam | Should - Be " testvalue"
@@ -2559,9 +2564,13 @@ Describe "Invoke-RestMethod tests" -Tags "Feature", "RequireAdminOnWindows" {
25592564 $result.Output.method | Should - Be " TEST"
25602565 }
25612566
2562- It " Validate Invoke-RestMethod default ContentType for CustomMethod POST" {
2563- $uri = Get-WebListenerUrl - Test ' Post'
2564- $command = " Invoke-RestMethod -Uri '$uri ' -CustomMethod POST -Body 'testparam=testvalue'"
2567+ It " Validate Invoke-RestMethod default ContentType for CustomMethod <method>" - TestCases @ (
2568+ @ {method = " POST" }
2569+ @ {method = " PUT" }
2570+ ) {
2571+ param ($method )
2572+ $uri = Get-WebListenerUrl - Test $method
2573+ $command = " Invoke-RestMethod -Uri '$uri ' -CustomMethod $method -Body 'testparam=testvalue'"
25652574 $result = ExecuteWebCommand - command $command
25662575 $result.Output.form.testparam | Should - Be " testvalue"
25672576 $result.Output.Headers .' Content-Type' | Should - Be " application/x-www-form-urlencoded"
0 commit comments