From 83787b96519a2e1a88fdab82074c74f6427009c3 Mon Sep 17 00:00:00 2001 From: Roman Nikonov Date: Wed, 9 Mar 2022 23:48:53 +0300 Subject: [PATCH] Fix support content_type for dynamic_query_handler --- src/Server/HTTPHandler.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Server/HTTPHandler.cpp b/src/Server/HTTPHandler.cpp index 82c81cfe16e..e5c5a25a0e5 100644 --- a/src/Server/HTTPHandler.cpp +++ b/src/Server/HTTPHandler.cpp @@ -1125,7 +1125,13 @@ std::string PredefinedQueryHandler::getQuery(HTTPServerRequest & request, HTMLFo HTTPRequestHandlerFactoryPtr createDynamicHandlerFactory(IServer & server, const std::string & config_prefix) { const auto & query_param_name = server.config().getString(config_prefix + ".handler.query_param_name", "query"); - auto factory = std::make_shared>(server, std::move(query_param_name)); + + std::optional content_type_override; + if (server.config().has(config_prefix + ".handler.content_type")) + content_type_override = server.config().getString(config_prefix + ".handler.content_type"); + + auto factory = std::make_shared>( + server, std::move(query_param_name), std::move(content_type_override)); factory->addFiltersFromConfig(server.config(), config_prefix);