MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / createStaticHandlerFactory

Function createStaticHandlerFactory

src/Server/StaticRequestHandler.cpp:153–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153HTTPRequestHandlerFactoryPtr createStaticHandlerFactory(IServer & server,
154 const Poco::Util::AbstractConfiguration & config,
155 const std::string & config_prefix,
156 std::unordered_map<String, String> & common_headers)
157{
158 int status = config.getInt(config_prefix + ".handler.status", 200);
159 std::string response_content = config.getRawString(config_prefix + ".handler.response_content", "Ok.\n");
160
161 std::unordered_map<String, String> http_response_headers_override
162 = parseHTTPResponseHeadersWithCommons(config, config_prefix, "text/plain; charset=UTF-8", common_headers);
163
164 auto creator = [&server, http_response_headers_override, response_content, status]() -> std::unique_ptr<StaticRequestHandler>
165 { return std::make_unique<StaticRequestHandler>(server, response_content, http_response_headers_override, status); };
166
167 auto factory = std::make_shared<HandlingRuleHTTPHandlerFactory<StaticRequestHandler>>(std::move(creator));
168
169 factory->addFiltersFromConfig(config, config_prefix);
170
171 return factory;
172}
173
174}

Callers 1

Calls 4

addFiltersFromConfigMethod · 0.80
getIntMethod · 0.45
getRawStringMethod · 0.45

Tested by

no test coverage detected