Remove buf copy when the compressor exist (#1427)

This commit is contained in:
ZhouyihaiDing
2017-08-25 12:26:38 -07:00
committed by dfawley
parent c29d6389e6
commit 01089b2972
11 changed files with 111 additions and 89 deletions

View File

@ -104,12 +104,12 @@ func (h *testStreamHandler) handleStream(t *testing.T, s *transport.Stream) {
}
}
// send a response back to end the stream.
reply, err := encode(testCodec{}, &expectedResponse, nil, nil, nil)
hdr, data, err := encode(testCodec{}, &expectedResponse, nil, nil, nil)
if err != nil {
t.Errorf("Failed to encode the response: %v", err)
return
}
h.t.Write(s, reply, &transport.Options{})
h.t.Write(s, hdr, data, &transport.Options{})
h.t.WriteStatus(s, status.New(codes.OK, ""))
}