| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -399,6 +399,19 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" { | |
| $result = ExecuteWebCommand -command $command | ||
| $result.Error | Should BeNullOrEmpty | ||
| } | ||
|
|
||
| It "Validate Invoke-WebRequest returns HTTP errors in exception" { | ||
|
|
||
| $command = "Invoke-WebRequest -Uri http://httpbin.org/status/418" | ||
| $result = ExecuteWebCommand -command $command | ||
|
|
||
| $result.Error.ErrorDetails.Message | Should Match "\-=\[ teapot \]" | ||
| $result.Error.Exception | Should BeOfType Microsoft.PowerShell.Commands.HttpResponseException | ||
| $result.Error.Exception.Response.StatusCode | Should Be 418 | ||
| $result.Error.Exception.Response.ReasonPhrase | Should Be "I'm a teapot" | ||
| $result.Error.Exception.Message | Should Match ": 418 \(I'm a teapot\)\." | ||
| $result.Error.FullyQualifiedErrorId | Should Be "WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand" | ||
| } | ||
| } | ||
|
|
||
| Describe "Invoke-RestMethod tests" -Tags "Feature" { | ||
| Expand Down Expand Up | @@ -642,6 +655,19 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" { | |
| $result = ExecuteWebCommand -command $command | ||
| $result.Error | Should BeNullOrEmpty | ||
| } | ||
|
|
||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitypls add a test with a response content
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitywill do
Sorry, something went wrong.
All reactions
|
||
| It "Validate Invoke-RestMethod returns HTTP errors in exception" { | ||
|
|
||
| $command = "Invoke-RestMethod -Uri http://httpbin.org/status/418" | ||
| $result = ExecuteWebCommand -command $command | ||
|
|
||
| $result.Error.ErrorDetails.Message | Should Match "\-=\[ teapot \]" | ||
| $result.Error.Exception | Should BeOfType Microsoft.PowerShell.Commands.HttpResponseException | ||
| $result.Error.Exception.Response.StatusCode | Should Be 418 | ||
| $result.Error.Exception.Response.ReasonPhrase | Should Be "I'm a teapot" | ||
| $result.Error.Exception.Message | Should Match ": 418 \(I'm a teapot\)\." | ||
| $result.Error.FullyQualifiedErrorId | Should Be "WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand" | ||
| } | ||
| } | ||
|
|
||
| Describe "Validate Invoke-WebRequest and Invoke-RestMethod -InFile" -Tags "Feature" { | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI suggest moving the class into a separate file
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI did a search of the existing source and it appears that in some cases Exceptions are declared in a separate file (like SessionStateExceptions.cs), but in many other cases, the Exception is declared where it's used (like parserutils.cs).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.