mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdhttp: use EcodePrevValueRequired when appropriate
This commit is contained in:
parent
5da481213e
commit
ab69c2adbd
@ -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`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user