mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Fix types in OCS json answer (status code is an int)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
f2cdc4f47d
commit
2a5e18b67a
3 changed files with 3 additions and 5 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue