Explorar o código

Merge pull request #1922 from EmmanuelVella/patch-17

Throw http not found exception instead of runtime
Thomas %!s(int64=11) %!d(string=hai) anos
pai
achega
6c420d2721
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      Controller/CRUDController.php

+ 4 - 2
Controller/CRUDController.php

@@ -391,8 +391,10 @@ class CRUDController extends Controller
      */
     public function batchAction()
     {
-        if ($this->getRestMethod() != 'POST') {
-            throw new \RuntimeException('invalid request type, POST expected');
+        $restMethod = $this->getRestMethod();
+
+        if ('POST' !== $restMethod) {
+            throw $this->createNotFoundException(sprintf('Invalid request type "%s", POST expected', $restMethod));
         }
 
         // check the csrf token