Browse Source
Fix types in OCS json answer (status code is an int)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/34997/head
Côme Chilliet
4 years ago
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
3 changed files with
3 additions and
5 deletions
-
lib/private/AppFramework/OCS/BaseResponse.php
-
lib/private/AppFramework/OCS/V1Response.php
-
lib/private/AppFramework/OCS/V2Response.php
|
|
|
@ -92,7 +92,7 @@ abstract class BaseResponse extends Response { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string[] $meta |
|
|
|
* @param array<string,string|int> $meta |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
protected function renderResult(array $meta): string { |
|
|
|
|
|
|
|
@ -28,7 +28,6 @@ use OCP\AppFramework\Http; |
|
|
|
use OCP\AppFramework\OCSController; |
|
|
|
|
|
|
|
class V1Response extends BaseResponse { |
|
|
|
|
|
|
|
/** |
|
|
|
* The V1 endpoint has very limited http status codes basically everything |
|
|
|
* is status 200 except 401 |
|
|
|
@ -68,7 +67,7 @@ class V1Response extends BaseResponse { |
|
|
|
public function render() { |
|
|
|
$meta = [ |
|
|
|
'status' => $this->getOCSStatus() === 100 ? 'ok' : 'failure', |
|
|
|
'statuscode' => (string)$this->getOCSStatus(), |
|
|
|
'statuscode' => $this->getOCSStatus(), |
|
|
|
'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage ?? '', |
|
|
|
'totalitems' => (string)($this->itemsCount ?? ''), |
|
|
|
'itemsperpage' => (string)($this->itemsPerPage ?? ''), |
|
|
|
|
|
|
|
@ -27,7 +27,6 @@ use OCP\AppFramework\Http; |
|
|
|
use OCP\AppFramework\OCSController; |
|
|
|
|
|
|
|
class V2Response extends BaseResponse { |
|
|
|
|
|
|
|
/** |
|
|
|
* The V2 endpoint just passes on status codes. |
|
|
|
* Of course we have to map the OCS specific codes to proper HTTP status codes |
|
|
|
@ -61,7 +60,7 @@ class V2Response extends BaseResponse { |
|
|
|
$meta = [ |
|
|
|
'status' => $status >= 200 && $status < 300 ? 'ok' : 'failure', |
|
|
|
'statuscode' => $this->getOCSStatus(), |
|
|
|
'message' => $status >= 200 && $status < 300 ? 'OK' : $this->statusMessage, |
|
|
|
'message' => $status >= 200 && $status < 300 ? 'OK' : $this->statusMessage ?? '', |
|
|
|
]; |
|
|
|
|
|
|
|
if ($this->itemsCount !== null) { |
|
|
|
|