mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Better handle nil responses in logical unwrap
This commit is contained in:
@@ -135,13 +135,17 @@ func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.c.RawRequest(r)
|
resp, err := c.c.RawRequest(r)
|
||||||
|
if resp != nil {
|
||||||
|
defer resp.Body.Close()
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
if resp != nil && resp.StatusCode != 404 {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
|
||||||
if err != nil && resp.StatusCode != 404 {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case http.StatusOK: // New method is supported
|
case http.StatusOK: // New method is supported
|
||||||
|
|||||||
Reference in New Issue
Block a user