handle empty host

This commit is contained in:
einhornimmond 2021-07-13 17:42:18 +02:00
parent 9f1809624b
commit 593f8eab83
3 changed files with 17 additions and 1 deletions

View File

@ -36,6 +36,10 @@ JsonRequestReturn JsonRequest::request(const char* methodName, const Poco::JSON:
// send post request via https
// 443 = HTTPS Default
// TODO: adding port into ServerConfig
if (mServerHost.empty() || !mServerPort) {
addError(new Error(functionName, "server host or server port not given"));
return JSON_REQUEST_PARAMETER_ERROR;
}
try {
Profiler phpRequestTime;

View File

@ -20,6 +20,7 @@ enum JsonRequestReturn
JSON_REQUEST_RETURN_OK,
JSON_REQUEST_RETURN_PARSE_ERROR,
JSON_REQUEST_RETURN_ERROR,
JSON_REQUEST_PARAMETER_ERROR,
JSON_REQUEST_CONNECT_ERROR
};

View File

@ -9,6 +9,7 @@ void TestJsonCreateTransaction::SetUp()
mUserSession = sm->getNewSession();
auto user = controller::User::create();
user->load("Jeet_bb@gmail.com");
user->login("TestP4ssword&H");
mUserSession->setUser(user);
}
@ -25,6 +26,9 @@ Poco::JSON::Object::Ptr TestJsonCreateTransaction::basisSetup()
{
Poco::JSON::Object::Ptr params = new Poco::JSON::Object;
params->set("session_id", mUserSession->getHandle());
params->set("blockchain_type", "mysql");
params->set("memo", "Placolder for memo for test");
params->set("auto_sign", true);
return params;
}
@ -35,6 +39,13 @@ TEST_F(TestJsonCreateTransaction, Creation)
auto params = basisSetup();
params->set("transaction_type", "creation");
params->set("target_email", "Elfenhausen@arcor.de");
params->set("amount", 10000000);
params->set("target_date", "2021-07-13T13:00:00");
auto result = jsonCall.handle(params);
std::stringstream ss;
result->stringify(ss);
printf("result: %s\n", ss.str().data());
//*/
}