mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Decoupled RequestContext from MHD_Connection
This will simplify testing of Response utilities.
This commit is contained in:
@ -8,9 +8,11 @@ namespace
|
||||
|
||||
using namespace kiwix;
|
||||
|
||||
RequestContext makeHttpGetRequest(const std::string& url)
|
||||
RequestContext makeHttpGetRequest(const std::string& url,
|
||||
const RequestContext::NameValuePairs& headers,
|
||||
const RequestContext::NameValuePairs& queryArgs)
|
||||
{
|
||||
return RequestContext(nullptr, "", url, "GET", "1.1");
|
||||
return RequestContext("", url, "GET", "1.1", headers, queryArgs);
|
||||
}
|
||||
|
||||
std::string getResponseContent(const ContentResponseBlueprint& crb)
|
||||
@ -23,7 +25,7 @@ std::string getResponseContent(const ContentResponseBlueprint& crb)
|
||||
|
||||
|
||||
TEST(HTTPErrorResponse, shouldBeInEnglishByDefault) {
|
||||
const RequestContext req = makeHttpGetRequest("/asdf");
|
||||
const RequestContext req = makeHttpGetRequest("/asdf", {}, {});
|
||||
HTTPErrorResponse errResp(req, MHD_HTTP_NOT_FOUND,
|
||||
"404-page-title",
|
||||
"404-page-heading",
|
||||
|
Reference in New Issue
Block a user