From: Michael Friedrich Date: Sun, 27 Sep 2015 13:27:08 +0000 (+0200) Subject: Ensure that multiple object handler request methods still work X-Git-Tag: v2.4.0~274 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6549721ec6c46a199a96a9e4443a7a5fea01c448;p=icinga2 Ensure that multiple object handler request methods still work refs #10194 --- diff --git a/lib/remote/createobjecthandler.cpp b/lib/remote/createobjecthandler.cpp index 0222413e3..fa1c3f2ef 100644 --- a/lib/remote/createobjecthandler.cpp +++ b/lib/remote/createobjecthandler.cpp @@ -32,8 +32,8 @@ REGISTER_URLHANDLER("/v1", CreateObjectHandler); bool CreateObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request, HttpResponse& response) { if (request.RequestMethod != "PUT") { - HttpUtility::SendJsonError(response, 400, "Invalid request type. Must be PUT."); - return true; + /* there might be other request methods pending */ + return false; } if (request.RequestUrl->GetPath().size() < 3) { diff --git a/lib/remote/deleteobjecthandler.cpp b/lib/remote/deleteobjecthandler.cpp index 7d797ce73..f4b89d284 100644 --- a/lib/remote/deleteobjecthandler.cpp +++ b/lib/remote/deleteobjecthandler.cpp @@ -35,8 +35,8 @@ REGISTER_URLHANDLER("/v1", DeleteObjectHandler); bool DeleteObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request, HttpResponse& response) { if (request.RequestMethod != "DELETE") { - HttpUtility::SendJsonError(response, 400, "Invalid request type. Must be DELETE."); - return true; + /* there might be other request methods pending */ + return false; } if (request.RequestUrl->GetPath().size() < 2) { diff --git a/lib/remote/modifyobjecthandler.cpp b/lib/remote/modifyobjecthandler.cpp index 1c3b02063..239578ce3 100644 --- a/lib/remote/modifyobjecthandler.cpp +++ b/lib/remote/modifyobjecthandler.cpp @@ -32,8 +32,10 @@ REGISTER_URLHANDLER("/v1", ModifyObjectHandler); bool ModifyObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request, HttpResponse& response) { - if (request.RequestMethod != "POST") + if (request.RequestMethod != "POST") { + /* there might be other request methods pending */ return false; + } if (request.RequestUrl->GetPath().size() < 2) return false;