Add endpoint for getting a feed via it's URL, as well as caching the result
This commit is contained in:
1 parent
70e78bcf42
commit
78ed53d529
5 files changed
+55
-31
No files matched your search
@@ -26,6 +26,22 @@ class FeedController
|
||||
return $this->view->render($response, 'index.twig.html', ['feeds' => $feeds]);
|
||||
}
|
||||
|
||||
public function get_feed(ServerRequestInterface $request, ResponseInterface $response)
|
||||
{
|
||||
$this->logger->info("FeedController::get_feed() called");
|
||||
$feed = $this->feedRepository->find($request->getAttribute('id'));
|
||||
$filtered = $feed->get_filtered_feed();
|
||||
|
||||
$body = $response->getBody();
|
||||
$body->write($filtered->asXML());
|
||||
|
||||
$this->feedRepository->save($feed);
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/rss+xml')
|
||||
->withBody($body)
|
||||
->withStatus(200);
|
||||
}
|
||||
|
||||
public function create(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
|
||||
{
|
||||
$this->logger->info("FeedController::create() called");
|
||||
|
||||
Reference in new issue
Block a user