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

Method TestFlags

test/brpc_builtin_service_unittest.cpp:275–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273 }
274
275 void TestFlags(bool use_html) {
276 std::string expect_type = (use_html ? "text/html" : "text/plain");
277 brpc::FlagsService service;
278 brpc::FlagsRequest req;
279 brpc::FlagsResponse res;
280 {
281 ClosureChecker done;
282 brpc::Controller cntl;
283 SetUpController(&cntl, use_html);
284 service.default_method(&cntl, &req, &res, &done);
285 EXPECT_FALSE(cntl.Failed());
286 EXPECT_EQ(expect_type, cntl.http_response().content_type());
287 CheckContent(cntl, "bthread_concurrency");
288 }
289 {
290 ClosureChecker done;
291 brpc::Controller cntl;
292 SetUpController(&cntl, use_html);
293 cntl.http_request()._unresolved_path = "foo";
294 service.default_method(&cntl, &req, &res, &done);
295 EXPECT_FALSE(cntl.Failed());
296 EXPECT_EQ(expect_type, cntl.http_response().content_type());
297 CheckContent(cntl, "false");
298 }
299 {
300 ClosureChecker done;
301 brpc::Controller cntl;
302 SetUpController(&cntl, use_html);
303 cntl.http_request()._unresolved_path = "foo";
304 cntl.http_request().uri()
305 .SetQuery(brpc::SETVALUE_STR, "true");
306 service.default_method(&cntl, &req, &res, &done);
307 EXPECT_FALSE(cntl.Failed());
308 EXPECT_EQ(expect_type, cntl.http_response().content_type());
309 }
310 {
311 ClosureChecker done;
312 brpc::Controller cntl;
313 SetUpController(&cntl, use_html);
314 cntl.http_request()._unresolved_path = "foo";
315 service.default_method(&cntl, &req, &res, &done);
316 EXPECT_FALSE(cntl.Failed());
317 EXPECT_EQ(expect_type, cntl.http_response().content_type());
318 CheckContent(cntl, "true");
319 }
320 }
321
322 void TestRpcz(bool enable, bool hex, bool use_html) {
323 std::string expect_type = (use_html ? "text/html" : "text/plain");

Callers

nothing calls this directly

Calls 4

CheckContentFunction · 0.85
SetQueryMethod · 0.80
default_methodMethod · 0.45
FailedMethod · 0.45

Tested by

no test coverage detected