Skip to content

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

@bsvihovec

Description

@bsvihovec

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions