mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
api: return parse errors if any for storage endpoints (#12338)
* logical/list: return parseErr if any * changelog * Add parseErr to other API endpoints * Update 12338.txt
This commit is contained in:
parent
fa91a68dec
commit
5e505ec039
2 changed files with 8 additions and 5 deletions
|
|
@ -81,7 +81,7 @@ func (c *Logical) ReadWithData(path string, data map[string][]string) (*Secret,
|
|||
case io.EOF:
|
||||
return nil, nil
|
||||
default:
|
||||
return nil, err
|
||||
return nil, parseErr
|
||||
}
|
||||
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
|
||||
return secret, nil
|
||||
|
|
@ -115,7 +115,7 @@ func (c *Logical) List(path string) (*Secret, error) {
|
|||
case io.EOF:
|
||||
return nil, nil
|
||||
default:
|
||||
return nil, err
|
||||
return nil, parseErr
|
||||
}
|
||||
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
|
||||
return secret, nil
|
||||
|
|
@ -159,7 +159,7 @@ func (c *Logical) write(path string, request *Request) (*Secret, error) {
|
|||
case io.EOF:
|
||||
return nil, nil
|
||||
default:
|
||||
return nil, err
|
||||
return nil, parseErr
|
||||
}
|
||||
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
|
||||
return secret, err
|
||||
|
|
@ -206,7 +206,7 @@ func (c *Logical) DeleteWithData(path string, data map[string][]string) (*Secret
|
|||
case io.EOF:
|
||||
return nil, nil
|
||||
default:
|
||||
return nil, err
|
||||
return nil, parseErr
|
||||
}
|
||||
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
|
||||
return secret, err
|
||||
|
|
@ -259,7 +259,7 @@ func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) {
|
|||
case io.EOF:
|
||||
return nil, nil
|
||||
default:
|
||||
return nil, err
|
||||
return nil, parseErr
|
||||
}
|
||||
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
|
||||
return secret, nil
|
||||
|
|
|
|||
3
changelog/12338.txt
Normal file
3
changelog/12338.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note: bug
|
||||
api: Fixes storage APIs returning incorrect error when parsing responses
|
||||
```
|
||||
Loading…
Reference in a new issue