From 25d9158171fceb3f2bc1cba0dca4a8f2c582d619 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sun, 19 Mar 2017 21:54:28 -0400 Subject: [PATCH] Fix output of NCN version list List is supposed to be contained in a JSON object, not a bare list --- lib/REST/NextCloudNews/Versions.php | 7 ++++++- tests/REST/NextCloudNews/TestNCNVersionDiscovery.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/REST/NextCloudNews/Versions.php b/lib/REST/NextCloudNews/Versions.php index 992d66af..24794161 100644 --- a/lib/REST/NextCloudNews/Versions.php +++ b/lib/REST/NextCloudNews/Versions.php @@ -17,7 +17,12 @@ class Versions implements \JKingWeb\NewsSync\REST\Handler { return new Response(405); } if(preg_match("<^/?$>",$path)) { - return new Response(200, ['v1-2']); + $out = [ + 'apiLevels' => [ + 'v1-2' + ] + ]; + return new Response(200, $out); } else { return new Response(404); } diff --git a/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php b/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php index 68dc0574..d58f5b9e 100644 --- a/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php +++ b/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php @@ -14,7 +14,7 @@ class TestNCNVersionDiscovery extends \PHPUnit\Framework\TestCase { } function testVersionList() { - $exp = new Response(200, ['v1-2']); + $exp = new Response(200, ['apiLevels' => ['v1-2']]); $req = new Request("GET", "/"); $h = new Rest\NextCloudNews\Versions($this->data); $res = $h->dispatch($req);