Set proper status code in OCS AppFramework Middleware

This commit is contained in:
Roeland Jago Douma 2016-07-22 12:14:54 +02:00
parent 194c385c7a
commit b543fd8d30
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
1 changed files with 6 additions and 1 deletions

View File

@ -56,7 +56,12 @@ class OCSMiddleware extends Middleware {
if ($code === 0) {
$code = Http::STATUS_INTERNAL_SERVER_ERROR;
}
return new OCSResponse($format, $code, $exception->getMessage());
$response = new OCSResponse($format, $code, $exception->getMessage());
if ($this->request->getScriptName() === '/ocs/v2.php') {
$response->setStatus($code);
}
return $response;
}
throw $exception;