Return 400 instead of 500 if generic backend is written to without data.

Fixes #825
This commit is contained in:
Jeff Mitchell 2015-12-09 10:39:22 -05:00
parent 8699adbbb0
commit 900b3d8882
2 changed files with 3 additions and 1 deletions

View File

@ -97,6 +97,8 @@ generate them, leading to client errors.
* secret/generic: Validate given duration at write time, not just read time;
if stored durations are not parseable, return a warning and the default
duration rather than an error [GH-718]
* secret/generic: Return 400 instead of 500 when `generic` backend is written
to with no data fields [GH-825]
* secret/postgresql: Revoke permissions before dropping a user or revocation
may fail [GH-699]

View File

@ -149,7 +149,7 @@ func (b *PassthroughBackend) handleWrite(
req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
// Check that some fields are given
if len(req.Data) == 0 {
return nil, fmt.Errorf("missing data fields")
return logical.ErrorResponse("missing data fields"), nil
}
// Check if there is a ttl key; verify parseability if so