mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #3289 from yichengq/marshal
etcdserver: go back to marshal request in 2.1 way
This commit is contained in:
commit
a17288558e
@ -529,9 +529,7 @@ func (s *EtcdServer) Do(ctx context.Context, r pb.Request) (Response, error) {
|
||||
}
|
||||
switch r.Method {
|
||||
case "POST", "PUT", "DELETE", "QGET":
|
||||
var raftReq pb.InternalRaftRequest
|
||||
raftReq.V2 = &r
|
||||
data, err := raftReq.Marshal()
|
||||
data, err := r.Marshal()
|
||||
if err != nil {
|
||||
return Response{}, err
|
||||
}
|
||||
|
@ -989,11 +989,10 @@ func TestPublish(t *testing.T) {
|
||||
t.Fatalf("action = %s, want Propose", action[0].Name)
|
||||
}
|
||||
data := action[0].Params[0].([]byte)
|
||||
var rr pb.InternalRaftRequest
|
||||
if err := rr.Unmarshal(data); err != nil {
|
||||
var r pb.Request
|
||||
if err := r.Unmarshal(data); err != nil {
|
||||
t.Fatalf("unmarshal request error: %v", err)
|
||||
}
|
||||
r := rr.V2
|
||||
if r.Method != "PUT" {
|
||||
t.Errorf("method = %s, want PUT", r.Method)
|
||||
}
|
||||
@ -1073,11 +1072,10 @@ func TestUpdateVersion(t *testing.T) {
|
||||
t.Fatalf("action = %s, want Propose", action[0].Name)
|
||||
}
|
||||
data := action[0].Params[0].([]byte)
|
||||
var rr pb.InternalRaftRequest
|
||||
if err := rr.Unmarshal(data); err != nil {
|
||||
var r pb.Request
|
||||
if err := r.Unmarshal(data); err != nil {
|
||||
t.Fatalf("unmarshal request error: %v", err)
|
||||
}
|
||||
r := rr.V2
|
||||
if r.Method != "PUT" {
|
||||
t.Errorf("method = %s, want PUT", r.Method)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user