Introduce operator+= to simplify response creation.

This commit is contained in:
Matthieu Gautier committed 2022-05-23 10:56:39 +02:00
1 parent f42f6a60df
commit 4695f47dd2
3 files changed
+23 -6

No files matched your search

+7 -6
View File
@@ -633,12 +633,13 @@ std::unique_ptr<Response> InternalServer::handle_search(const RequestContext& re
// Searcher->search will throw a runtime error if there is no valid xapian database to do the search.
// (in case of zim file not containing a index)
const auto cssUrl = renderUrl(m_root, RESOURCE::templates::url_of_search_results_css);
return HTTPErrorHtmlResponse(*this, request, MHD_HTTP_NOT_FOUND,
"fulltext-search-unavailable",
"404-page-heading",
cssUrl)
+ nonParameterizedMessage("no-search-results")
+ TaskbarInfo(searchInfo.bookName, archive.get());
HTTPErrorHtmlResponse response(*this, request, MHD_HTTP_NOT_FOUND,
"fulltext-search-unavailable",
"404-page-heading",
cssUrl);
response += nonParameterizedMessage("no-search-results");
response += TaskbarInfo(searchInfo.bookName, archive.get());
return response;
}