Always process responses inside RootResource

The REST API would skip propagation of the requests to the RootResource if
it was a request to the empty resource.
This commit is contained in:
Markus Mäkelä 2018-11-08 06:55:09 +02:00
parent 7d54df74dc
commit d65269fabb
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 6 additions and 8 deletions

View File

@ -121,12 +121,7 @@ int Client::process(string url, string method, const char* upload_data, size_t*
MXS_DEBUG("Request:\n%s", request.to_string().c_str());
if (url == "/")
{
// Respond to pings with 200 OK
reply = HttpResponse(MHD_HTTP_OK);
}
else if (request.validate_api_version())
if (request.validate_api_version())
{
reply = resource_handle_request(request);
}

View File

@ -86,8 +86,11 @@ bool HttpRequest::validate_api_version()
{
bool rval = false;
if (m_resource_parts.size() > 0
&& m_resource_parts[0] == MXS_REST_API_VERSION)
if (m_resource_parts.empty())
{
rval = true;
}
else if (m_resource_parts[0] == MXS_REST_API_VERSION)
{
m_resource_parts.pop_front();
rval = true;