fixed tests and style

This commit is contained in:
Javi Santana 2020-08-17 09:46:38 +02:00
parent f04f984fb2
commit ce64a73342
2 changed files with 5 additions and 3 deletions

View File

@ -75,14 +75,16 @@ void ReplicasStatusHandler::handleRequest(Poco::Net::HTTPServerRequest & request
const auto & config = context.getConfigRef();
setResponseDefaultHeaders(response, config.getUInt("keep_alive_timeout", 10));
if (!ok) {
if (!ok)
{
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_SERVICE_UNAVAILABLE);
verbose = true;
}
if (verbose)
response.send() << message.rdbuf();
else {
else
{
const char * data = "Ok.\n";
response.sendBuffer(data, strlen(data));
}

View File

@ -122,7 +122,7 @@ def test_defaults_http_handlers():
assert 'Ok.\n' == cluster.instance.http_request('ping', method='GET').content
assert 200 == cluster.instance.http_request('replicas_status', method='get').status_code
assert 'ok.\n' == cluster.instance.http_request('replicas_status', method='get').content
assert 'Ok.\n' == cluster.instance.http_request('replicas_status', method='get').content
assert 200 == cluster.instance.http_request('replicas_status?verbose=1', method='get').status_code
assert '\n' == cluster.instance.http_request('replicas_status?verbose=1', method='get').content