From 3a695742e37d98cfdfbc44e2bad95fd9258e5e02 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 7 Nov 2015 09:11:16 +0100 Subject: [PATCH] Improve error handling when user specifies invalid method for /v1/console refs #10387 --- lib/remote/consolehandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/remote/consolehandler.cpp b/lib/remote/consolehandler.cpp index 5169fefd5..5bd43553c 100644 --- a/lib/remote/consolehandler.cpp +++ b/lib/remote/consolehandler.cpp @@ -93,12 +93,12 @@ bool ConsoleHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& reques bool sandboxed = HttpUtility::GetLastParameter(params, "sandboxed"); - if (methodName == "execute-script") { + if (methodName == "execute-script") return ExecuteScriptHelper(request, response, command, session, sandboxed); - } else if (methodName == "auto-complete-script") { + else if (methodName == "auto-complete-script") return AutocompleteScriptHelper(request, response, command, session, sandboxed); - } + HttpUtility::SendJsonError(response, 400, "Invalid method specified: " + methodName); return true; }