diff --git a/etcdserver/etcdhttp/http.go b/etcdserver/etcdhttp/http.go index ced2bfbe2..760391f8f 100644 --- a/etcdserver/etcdhttp/http.go +++ b/etcdserver/etcdhttp/http.go @@ -354,7 +354,7 @@ func parseKeyRequest(r *http.Request, id uint64, clock clockwork.Clock) (etcdser ) } - var rec, sort, wait, dir, stream bool + var rec, sort, wait, dir, quorum, stream bool if rec, err = getBool(r.Form, "recursive"); err != nil { return emptyReq, etcdErr.NewRequestError( etcdErr.EcodeInvalidField, @@ -380,6 +380,12 @@ func parseKeyRequest(r *http.Request, id uint64, clock clockwork.Clock) (etcdser `invalid value for "dir"`, ) } + if quorum, err = getBool(r.Form, "quorum"); err != nil { + return emptyReq, etcdErr.NewRequestError( + etcdErr.EcodeInvalidField, + `invalid value for "quorum"`, + ) + } if stream, err = getBool(r.Form, "stream"); err != nil { return emptyReq, etcdErr.NewRequestError( etcdErr.EcodeInvalidField, @@ -438,11 +444,12 @@ func parseKeyRequest(r *http.Request, id uint64, clock clockwork.Clock) (etcdser PrevValue: pV, PrevIndex: pIdx, PrevExist: pe, - Recursive: rec, - Since: wIdx, - Sorted: sort, - Stream: stream, Wait: wait, + Since: wIdx, + Recursive: rec, + Sorted: sort, + Quorum: quorum, + Stream: stream, } if pe != nil { diff --git a/etcdserver/etcdhttp/http_test.go b/etcdserver/etcdhttp/http_test.go index 094b59349..d570ea8d5 100644 --- a/etcdserver/etcdhttp/http_test.go +++ b/etcdserver/etcdhttp/http_test.go @@ -169,6 +169,14 @@ func TestBadParseRequest(t *testing.T) { mustNewForm(t, "foo", url.Values{"dir": []string{"file"}}), etcdErr.EcodeInvalidField, }, + { + mustNewForm(t, "foo", url.Values{"quorum": []string{"no"}}), + etcdErr.EcodeInvalidField, + }, + { + mustNewForm(t, "foo", url.Values{"quorum": []string{"file"}}), + etcdErr.EcodeInvalidField, + }, { mustNewForm(t, "foo", url.Values{"stream": []string{"zzz"}}), etcdErr.EcodeInvalidField, @@ -307,6 +315,20 @@ func TestGoodParseRequest(t *testing.T) { Path: path.Join(etcdserver.StoreKeysPrefix, "/foo"), }, }, + { + // quorum specified + mustNewForm( + t, + "foo", + url.Values{"quorum": []string{"true"}}, + ), + etcdserverpb.Request{ + ID: 1234, + Method: "PUT", + Quorum: true, + Path: path.Join(etcdserver.StoreKeysPrefix, "/foo"), + }, + }, { // wait specified mustNewRequest(t, "foo?wait=true"),