MCPcopy Create free account
hub / github.com/apache/brpc / MakeH2EchoResponseBuf

Method MakeH2EchoResponseBuf

test/brpc_http_rpc_protocol_unittest.cpp:280–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278 }
279
280 void MakeH2EchoResponseBuf(butil::IOBuf* out, int h2_stream_id) {
281 brpc::Controller cntl;
282 test::EchoResponse res;
283 res.set_message(EXP_RESPONSE);
284 cntl.http_request().set_content_type("application/proto");
285 {
286 butil::IOBufAsZeroCopyOutputStream wrapper(&cntl.response_attachment());
287 EXPECT_TRUE(res.SerializeToZeroCopyStream(&wrapper));
288 }
289 brpc::policy::H2UnsentResponse* h2_res = brpc::policy::H2UnsentResponse::New(&cntl, h2_stream_id, false /*is grpc*/);
290 butil::Status st = h2_res->AppendAndDestroySelf(out, _h2_client_sock.get());
291 ASSERT_TRUE(st.ok());
292 }
293
294 int _pipe_fds[2];
295 brpc::SocketUniquePtr _socket;

Callers

nothing calls this directly

Calls 4

set_content_typeMethod · 0.80
okMethod · 0.80
AppendAndDestroySelfMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected