Skip to content
New issue

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

[FEAT] Return more information from a failed HTTP request #518

Open
bsvihovec opened this issue Feb 24, 2025 · 0 comments
Open

[FEAT] Return more information from a failed HTTP request #518

bsvihovec opened this issue Feb 24, 2025 · 0 comments

Comments

@bsvihovec
Copy link

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

We maintain an HTTP server that provides access to access Terraform modules using custom query parameters in the source URL.

If there is an issue with the query parameters, and the server returns a 400, the only message that is displayed to the user is:

Error: Response code 400 (Bad Request)

Describe the solution you'd like:

On error return more information from the failed HTTP request.

For example, an error returned by the server can provide a message field or an errors field, which is displayed to the user.

Error: Response code 400 (Bad Request) 

Errors:  The provided query parameter "foo" contains an invalid value.

Describe alternatives you've considered
N/A

Additional context

Current return logic:

if resp.StatusCode < 200 || resp.StatusCode >= 300 {

Similar request from the vault-action repo:
hashicorp/vault-action#273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants