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

Method MakeResponseMessage

test/brpc_http_rpc_protocol_unittest.cpp:229–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227
228
229 brpc::policy::HttpContext* MakeResponseMessage(int code) {
230 brpc::policy::HttpContext* msg = new brpc::policy::HttpContext(false);
231 msg->header().set_status_code(code);
232 msg->header().set_content_type("application/json");
233
234 test::EchoResponse res;
235 res.set_message(EXP_RESPONSE);
236 butil::IOBufAsZeroCopyOutputStream res_stream(&msg->body());
237 EXPECT_TRUE(json2pb::ProtoMessageToJson(res, &res_stream, NULL));
238 return msg;
239 }
240
241 void CheckResponseCode(bool expect_empty, int expect_code) {
242 int bytes_in_pipe = 0;

Callers

nothing calls this directly

Calls 3

set_status_codeMethod · 0.80
set_content_typeMethod · 0.80
ProtoMessageToJsonFunction · 0.50

Tested by

no test coverage detected