From d1e4c6eed32d9f9578ce16bb4ae6b2a182f57a79 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Fri, 29 Sep 2017 18:11:39 -0400 Subject: [PATCH] Fix 405 response of NCN version lister --- lib/REST/NextCloudNews/Versions.php | 2 +- tests/REST/NextCloudNews/TestNCNVersionDiscovery.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/REST/NextCloudNews/Versions.php b/lib/REST/NextCloudNews/Versions.php index df260cc0..9d5029dd 100644 --- a/lib/REST/NextCloudNews/Versions.php +++ b/lib/REST/NextCloudNews/Versions.php @@ -11,7 +11,7 @@ class Versions implements \JKingWeb\Arsse\REST\Handler { public function dispatch(\JKingWeb\Arsse\REST\Request $req): Response { // if a method other than GET was used, this is an error if ($req->method != "GET") { - return new Response(405); + return new Response(405, "", "", ["Allow: GET"]); } if (preg_match("<^/?$>", $req->path)) { // if the request path is an empty string or just a slash, return the supported versions diff --git a/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php b/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php index ad3f15a1..ddef8659 100644 --- a/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php +++ b/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php @@ -26,7 +26,7 @@ class TestNCNVersionDiscovery extends Test\AbstractTest { } public function testUseIncorrectMethod() { - $exp = new Response(405); + $exp = new Response(405, "", "", ["Allow: GET"]); $h = new REST\NextCloudNews\Versions(); $req = new Request("POST", "/"); $res = $h->dispatch($req);