diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-07-04 11:31:38 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-07-04 12:10:44 +0200 |
commit | 9bdf0973b337cbf73287422cc5fdceabc8703e61 (patch) | |
tree | fb02b08b50a33e39229e4d0cfddec15b36852942 /application/test/tests/api_v2/common.php | |
parent | 0ce11c1416c0bce491952410e791f7ca6cfad2dd (diff) |
API: Fix return type of empty values in file/history
If the array is not casted to a object, json_encode will encode it as
[] if empty, but {} if it contains data. Always return an object by
casting the array to an object if it is empty.
Fixes #15
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/test/tests/api_v2/common.php')
-rw-r--r-- | application/test/tests/api_v2/common.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/application/test/tests/api_v2/common.php b/application/test/tests/api_v2/common.php index dbef3cc9c..103e156a8 100644 --- a/application/test/tests/api_v2/common.php +++ b/application/test/tests/api_v2/common.php @@ -53,8 +53,8 @@ class common extends \test\Test { return $this->createApikey($userid, $access_level); } - protected function callEndpoint($verb, $endpoint, $data) + protected function callEndpoint($verb, $endpoint, $data, $return_json = false) { - return $this->CallAPI($verb, "$this->server_url/api/v2.0.0/$endpoint", $data); + return $this->CallAPI($verb, "$this->server_url/api/v2.0.0/$endpoint", $data, $return_json); } } |