Closed averche closed 11 months ago
When parsing error responses, if the message does not include "errors" or "error" JSON elements, the ResponseError.RawResponseBytes will be populated:
"errors"
"error"
ResponseError.RawResponseBytes
s, err := client.Secrets.KvV2Read(ctx, "my-secret", vault.WithMountPath("secret")) if err != nil { var e *vault.ResponseError if errors.As(err, &responseError) { log.Printf("response status code: %d", e.StatusCode) log.Printf("response body: %s", e.RawResponseBytes) } else { log.Println(err) } } assert(s == nil)
Resolves #246
Added a unit test.
Description
When parsing error responses, if the message does not include
"errors"
or"error"
JSON elements, theResponseError.RawResponseBytes
will be populated:Resolves #246
How has this been tested?
Added a unit test.