MXS-2411: Implicitly use latest API version

The request API prefix is now simply ignored as it has no meaning as long
as there is a single version of the API.
This commit is contained in:
Markus Mäkelä
2019-04-18 13:00:39 +03:00
parent a471417150
commit 3e41a601f8
4 changed files with 8 additions and 17 deletions

View File

@ -119,11 +119,8 @@ int Client::process(string url, string method, const char* upload_data, size_t*
HttpResponse reply(MHD_HTTP_NOT_FOUND);
MXS_DEBUG("Request:\n%s", request.to_string().c_str());
if (request.validate_api_version())
{
reply = resource_handle_request(request);
}
request.fix_api_version();
reply = resource_handle_request(request);
string data;

View File

@ -82,21 +82,12 @@ HttpRequest::~HttpRequest()
{
}
bool HttpRequest::validate_api_version()
void HttpRequest::fix_api_version()
{
bool rval = false;
if (m_resource_parts.empty())
{
rval = true;
}
else if (m_resource_parts[0] == MXS_REST_API_VERSION)
if (!m_resource_parts.empty() && m_resource_parts[0] == MXS_REST_API_VERSION)
{
m_resource_parts.pop_front();
rval = true;
}
return rval;
}
namespace

View File

@ -285,7 +285,7 @@ public:
*
* @return True if prefix is present and was successfully removed
*/
bool validate_api_version();
void fix_api_version();
private: