etcdhttp: use EcodePrevValueRequired when appropriate

This commit is contained in:
Jonathan Boulle 2014-11-03 16:12:24 -08:00
parent 5da481213e
commit ab69c2adbd
2 changed files with 2 additions and 2 deletions

View File

@ -342,7 +342,7 @@ func parseKeyRequest(r *http.Request, id uint64, clock clockwork.Clock) (etcdser
pV := r.FormValue("prevValue") pV := r.FormValue("prevValue")
if _, ok := r.Form["prevValue"]; ok && pV == "" { if _, ok := r.Form["prevValue"]; ok && pV == "" {
return emptyReq, etcdErr.NewRequestError( return emptyReq, etcdErr.NewRequestError(
etcdErr.EcodeInvalidField, etcdErr.EcodePrevValueRequired,
`"prevValue" cannot be empty`, `"prevValue" cannot be empty`,
) )
} }

View File

@ -257,7 +257,7 @@ func TestBadParseRequest(t *testing.T) {
// prevValue cannot be empty // prevValue cannot be empty
{ {
mustNewForm(t, "foo", url.Values{"prevValue": []string{""}}), mustNewForm(t, "foo", url.Values{"prevValue": []string{""}}),
etcdErr.EcodeInvalidField, etcdErr.EcodePrevValueRequired,
}, },
// wait is only valid with GET requests // wait is only valid with GET requests
{ {