|
@ -236,10 +236,6 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function dispatch(ServerRequestInterface $req): ResponseInterface { |
|
|
public function dispatch(ServerRequestInterface $req): ResponseInterface { |
|
|
// try to authenticate |
|
|
|
|
|
if (!$this->authenticate($req)) { |
|
|
|
|
|
return new ErrorResponse("401", 401); |
|
|
|
|
|
} |
|
|
|
|
|
// get the request path only; this is assumed to already be normalized |
|
|
// get the request path only; this is assumed to already be normalized |
|
|
$target = parse_url($req->getRequestTarget(), \PHP_URL_PATH) ?? ""; |
|
|
$target = parse_url($req->getRequestTarget(), \PHP_URL_PATH) ?? ""; |
|
|
$method = $req->getMethod(); |
|
|
$method = $req->getMethod(); |
|
@ -247,6 +243,10 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler { |
|
|
if ($method === "OPTIONS") { |
|
|
if ($method === "OPTIONS") { |
|
|
return $this->handleHTTPOptions($target); |
|
|
return $this->handleHTTPOptions($target); |
|
|
} |
|
|
} |
|
|
|
|
|
// try to authenticate |
|
|
|
|
|
if (!$this->authenticate($req)) { |
|
|
|
|
|
return new ErrorResponse("401", 401); |
|
|
|
|
|
} |
|
|
$func = $this->chooseCall($target, $method); |
|
|
$func = $this->chooseCall($target, $method); |
|
|
if ($func instanceof ResponseInterface) { |
|
|
if ($func instanceof ResponseInterface) { |
|
|
return $func; |
|
|
return $func; |
|
|