diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-01-29 12:04:54 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-01-29 12:04:54 +0100 |
commit | b9f180e0014f5bb3c37137f41a06df7acf2496e9 (patch) | |
tree | 8610fe9f7aaf8e473330f605478b4180476cbc3d | |
parent | 55142186deb9e163ce3519453ebfe93f6a446666 (diff) | |
download | nextcloud-server-b9f180e0014f5bb3c37137f41a06df7acf2496e9.tar.gz nextcloud-server-b9f180e0014f5bb3c37137f41a06df7acf2496e9.zip |
Use 403 instead of 200 response
A forbidden should throw a 403 and this makes it easier for me to do some automated testing.
-rw-r--r-- | settings/middleware/subadminmiddleware.php | 4 | ||||
-rw-r--r-- | tests/settings/middleware/subadminmiddlewaretest.php | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/settings/middleware/subadminmiddleware.php b/settings/middleware/subadminmiddleware.php index a5c005e3148..52b77cd7e4f 100644 --- a/settings/middleware/subadminmiddleware.php +++ b/settings/middleware/subadminmiddleware.php @@ -59,7 +59,9 @@ class SubadminMiddleware extends Middleware { * @return TemplateResponse */ public function afterException($controller, $methodName, \Exception $exception) { - return new TemplateResponse('core', '403', array(), 'guest'); + $response = new TemplateResponse('core', '403', array(), 'guest'); + $response->setStatus(Http::STATUS_FORBIDDEN); + return $response; } } diff --git a/tests/settings/middleware/subadminmiddlewaretest.php b/tests/settings/middleware/subadminmiddlewaretest.php index e5572cfba52..d0da19f60e1 100644 --- a/tests/settings/middleware/subadminmiddlewaretest.php +++ b/tests/settings/middleware/subadminmiddlewaretest.php @@ -81,11 +81,9 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo'); } - - - public function testAfterException() { $expectedResponse = new TemplateResponse('core', '403', array(), 'guest'); + $expectedResponse->setStatus(403); $this->assertEquals($expectedResponse, $this->subadminMiddleware->afterException($this->controller, 'foo', new \Exception())); } -}
\ No newline at end of file +} |