OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.55k stars 6.27k forks source link

[REQ][Powershell] Implement SkipHttpErrorCheck #8330

Open EngineerCoding opened 3 years ago

EngineerCoding commented 3 years ago

Is your feature request related to a problem? Please describe.

In some cases I need the response status code of an endpoint, even when it is in the 400-500 range. Currently this is stopped by the default Invoke-WebRequest cmdlet which checks for this status code and errors by default.

Describe the solution you'd like

Specify --SkipHttpErrorCheck like you can skip Https currently in the configuration.

Describe alternatives you've considered

try / catch, but doesnt result in the desired output.

Additional context

Can implement this myself, and also cleanup the ApiClient.ps1 code a little bit so that it is readable and future proof.

wing328 commented 3 years ago

What about setting $ErrorActionPreference to Continue instead? Would that work for you? (I've not tested it myself)