Skip to content

Optimize vault secret component error output #908

@Taction

Description

@Taction

Describe the proposal

When get secret encountered error, http.Response is formatted in error. For example, if get a key that not exsit, the error message is:

couldn't to get successful response: &http.Response{Status:"404 Not Found", StatusCode:404, Proto:"HTTP/1.1", ProtoMajor:1, ProtoMinor:1, Header:http.Header{"Cache-Control":[]string{"no-store"}, "Content-Length":[]string{"14"}, "Content-Type":[]string{"application/json"}, "Date":[]string{"Tue, 01 Jun 2021 13:48:49 GMT"}}, Body:(*http.bodyEOFSignal)(0xc000e26080), ContentLength:14, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc000b93e00), TLS:(*tls.ConnectionState)(nil)}, {"errors":[]}

In fact there much massage that not needed. StatusCode and the response body will be enough. Error message after optimized will be:

couldn't get successful response, status code 404, body {"errors":[]}

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