1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 06:04:53 +00:00

Fix 405 response of NCN version lister

This commit is contained in:
J. King 2017-09-29 18:11:39 -04:00
parent 00bc7a00a0
commit d1e4c6eed3
2 changed files with 2 additions and 2 deletions

View file

@ -11,7 +11,7 @@ class Versions implements \JKingWeb\Arsse\REST\Handler {
public function dispatch(\JKingWeb\Arsse\REST\Request $req): Response { public function dispatch(\JKingWeb\Arsse\REST\Request $req): Response {
// if a method other than GET was used, this is an error // if a method other than GET was used, this is an error
if ($req->method != "GET") { if ($req->method != "GET") {
return new Response(405); return new Response(405, "", "", ["Allow: GET"]);
} }
if (preg_match("<^/?$>", $req->path)) { if (preg_match("<^/?$>", $req->path)) {
// if the request path is an empty string or just a slash, return the supported versions // if the request path is an empty string or just a slash, return the supported versions

View file

@ -26,7 +26,7 @@ class TestNCNVersionDiscovery extends Test\AbstractTest {
} }
public function testUseIncorrectMethod() { public function testUseIncorrectMethod() {
$exp = new Response(405); $exp = new Response(405, "", "", ["Allow: GET"]);
$h = new REST\NextCloudNews\Versions(); $h = new REST\NextCloudNews\Versions();
$req = new Request("POST", "/"); $req = new Request("POST", "/");
$res = $h->dispatch($req); $res = $h->dispatch($req);