diff --git a/classes/Engine.php b/classes/Engine.php index 396251d..29830c1 100644 --- a/classes/Engine.php +++ b/classes/Engine.php @@ -142,12 +142,21 @@ class Engine implements RequestHandlerInterface { */ private function executeInvokableClass(RequestInterface $request, $args = null) { if (is_array($args) && count($args) > 0) { + // Explicit arguments take precedence $input = $args; - } else { + } elseif ($request->getMethod() == 'GET') { + // Handle GET requests only if class allows it + if ($this->reader->getFirstValueBool($this->object, 'phpmae:allowsGETRequests')) + $input = $request->getQueryParams(); + else + return (new Response(405)); + } elseif ($request->getMethod() == 'POST') { + // POST is always allowed $input = $request->getParsedBody(); if (!is_array($input)) - $input = []; - } + $input = []; + } else + return (new Response(405)); set_time_limit($this->container->has('execution_time_limit') ? $this->container->get('execution_time_limit') : self::CLASS_TIME_LIMIT);