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

Method Head

test/brpc_http_rpc_protocol_unittest.cpp:1871–1890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1869class HttpServiceImpl : public ::test::HttpService {
1870 public:
1871 void Head(::google::protobuf::RpcController* cntl_base,
1872 const ::test::HttpRequest*,
1873 ::test::HttpResponse*,
1874 ::google::protobuf::Closure* done) override {
1875 brpc::ClosureGuard done_guard(done);
1876 brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
1877 ASSERT_EQ(cntl->http_request().method(), brpc::HTTP_METHOD_HEAD);
1878 const std::string* index = cntl->http_request().GetHeader("x-db-index");
1879 ASSERT_NE(nullptr, index);
1880 int i;
1881 ASSERT_TRUE(butil::StringToInt(*index, &i));
1882 cntl->http_response().set_content_type("text/plain");
1883 if (i % 2 == 0) {
1884 cntl->http_response().SetHeader("Content-Length",
1885 EXP_RESPONSE_CONTENT_LENGTH);
1886 } else {
1887 cntl->http_response().SetHeader("Transfer-Encoding",
1888 EXP_RESPONSE_TRANSFER_ENCODING);
1889 }
1890 }
1891
1892 void Expect(::google::protobuf::RpcController* cntl_base,
1893 const ::test::HttpRequest*,

Callers

nothing calls this directly

Calls 5

StringToIntFunction · 0.85
GetHeaderMethod · 0.80
set_content_typeMethod · 0.80
SetHeaderMethod · 0.80
methodMethod · 0.45

Tested by

no test coverage detected