You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (resp.result != OpenShock::HTTP::RequestResult::Success) {
45
-
SERPR_ERROR("Tried to connect to \"%.*s\", but failed with status [%d] (%s), refusing to save domain to config", arg.length(), arg.data(), resp.code, resp.ResultToString());
36
+
OpenShock::HTTP::HTTPClient client;
37
+
auto response = client.GetJson<OpenShock::Serialization::JsonAPI::BackendVersionResponse>(uri, OpenShock::Serialization::JsonAPI::ParseBackendVersionJsonResponse);
38
+
if (!response.Ok() || response.StatusCode() != 200) {
39
+
SERPR_ERROR("Tried to connect to \"%.*s\", but failed with status [%d] (%s), refusing to save domain to config", arg.length(), arg.data(), response.StatusCode(), OpenShock::HTTP::HTTPErrorToString(response.Error()));
46
40
return;
47
41
}
48
42
49
-
OS_LOGI(TAG, "Successfully connected to \"%.*s\", version: %s, commit: %s, current time: %s", arg.length(), arg.data(), resp.data.version.c_str(), resp.data.commit.c_str(), resp.data.currentTime.c_str());
43
+
auto content = response.ReadJson();
44
+
if (content.error != OpenShock::HTTP::HTTPError::None) {
45
+
#error TODO: Handle this
46
+
}
47
+
48
+
OS_LOGI(TAG, "Successfully connected to \"%.*s\", version: %s, commit: %s, current time: %s", arg.length(), arg.data(), content.data.version.c_str(), content.data.commit.c_str(), content.data.currentTime.c_str());
50
49
51
50
bool result = OpenShock::Config::SetBackendDomain(std::string(arg));
0 commit comments