diff --git a/lib/Misc/Date.php b/lib/Misc/Date.php index b1afc5ad..0eacf8c0 100644 --- a/lib/Misc/Date.php +++ b/lib/Misc/Date.php @@ -6,7 +6,7 @@ declare(strict_types=1); namespace JKingWeb\Arsse\Misc; -class Date { +class Date { public static function transform($date, string $outFormat = null, string $inFormat = null) { $date = ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat); if (!$date) { diff --git a/lib/REST.php b/lib/REST.php index 1d3fa0a0..865e450d 100644 --- a/lib/REST.php +++ b/lib/REST.php @@ -41,12 +41,13 @@ class REST { // Google Reader http://feedhq.readthedocs.io/en/latest/api/index.html // Fever https://feedafever.com/api // Feedbin v2 https://github.com/feedbin/feedbin-api - // Feedbin v1 https://github.com/feedbin/feedbin-api/commit/86da10aac5f1a57531a6e17b08744e5f9e7db8a9 - // Miniflux https://github.com/miniflux/miniflux/blob/master/docs/json-rpc-api.markdown // CommaFeed https://www.commafeed.com/api/ + // Unclear if clients exist: + // Miniflux https://github.com/miniflux/miniflux/blob/master/docs/json-rpc-api.markdown // NextCloud News v2 https://github.com/nextcloud/news/blob/master/docs/externalapi/External-Api.md // Selfoss https://github.com/SSilence/selfoss/wiki/Restful-API-for-Apps-or-any-other-external-access // BirdReader https://github.com/glynnbird/birdreader/blob/master/API.md + // Feedbin v1 https://github.com/feedbin/feedbin-api/commit/86da10aac5f1a57531a6e17b08744e5f9e7db8a9 // Proprietary (centralized) entities: // NewsBlur http://www.newsblur.com/api // Feedly https://developer.feedly.com/ @@ -63,8 +64,8 @@ class REST { // find the API to handle try { list ($api, $target, $class) = $this->apiMatch($req->getRequestTarget(), $this->apis); - // modify the request to have a stripped target - $req = $req->withRequestTarget($target); + // modify the request to have an uppercase method and a stripped target + $req = $req->withMethod(strtoupper($req->getMethod()))->withRequestTarget($target); // fetch the correct handler $drv = $this->getHandler($class); // generate a response diff --git a/tests/cases/REST/TestREST.php b/tests/cases/REST/TestREST.php index 10aa59da..203565c4 100644 --- a/tests/cases/REST/TestREST.php +++ b/tests/cases/REST/TestREST.php @@ -120,6 +120,8 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { return [ [new ServerRequest([], [], "/index.php/apps/news/api/v1-2/feeds", "GET"), "GET", true, NCN::Class, "/feeds"], [new ServerRequest([], [], "/index.php/apps/news/api/v1-2/feeds", "HEAD"), "GET", true, NCN::Class, "/feeds"], + [new ServerRequest([], [], "/index.php/apps/news/api/v1-2/feeds", "get"), "GET", true, NCN::Class, "/feeds"], + [new ServerRequest([], [], "/index.php/apps/news/api/v1-2/feeds", "head"), "GET", true, NCN::Class, "/feeds"], [new ServerRequest([], [], "/tt-rss/api/", "POST"), "POST", true, TTRSS::Class, "/"], [new ServerRequest([], [], "/no/such/api/", "HEAD"), "GET", false], [new ServerRequest([], [], "/no/such/api/", "GET"), "GET", false],