Skip to content

Return a Response instead of attempting to decode HTML response as JSON for errors #66

@markerickson-wf

Description

@markerickson-wf

For example, a 403 response (unauthorized) returns an HTML page, but go-rest attempts to decode the body as JSON, and returns a cryptic error such as "invalid character '<' looking for beginning of value" instead of a Response object with the status code.

See https://github.com/Workiva/go-rest/blob/master/rest/client.go#L100 for how a 404 is correctly handled.

Are there any cases where we want to attempt to decode a JSON response if we have a status other than 200 (or 20x)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions