diff --git a/actions/DisplayAction.php b/actions/DisplayAction.php index 24bdefe14d4..93813004f22 100644 --- a/actions/DisplayAction.php +++ b/actions/DisplayAction.php @@ -32,7 +32,7 @@ public function execute(Request $request) return new Response('', 304, ['last-modified' => $modificationTimeGMT . 'GMT']); } } - return $cachedResponse; + return $cachedResponse->withHeader('rss-bridge', 'This is a cached response'); } if (!$bridgeName) { diff --git a/bridges/MediapartBlogsBridge.php b/bridges/MediapartBlogsBridge.php index fa8c3d5f1d3..d1e1c3c9867 100644 --- a/bridges/MediapartBlogsBridge.php +++ b/bridges/MediapartBlogsBridge.php @@ -35,7 +35,12 @@ public function collectData() $item['title'] = $item_title->innertext; $item['uri'] = self::BASE_URI . trim($item_title->href); - $item['author'] = $element->find('.author .subscriber', 0)->innertext; + + $author = $element->find('.author .subscriber', 0); + if ($author) { + $item['author'] = $author->innertext; + } + $item['content'] = $item_divs[count($item_divs) - 2] . $item_divs[count($item_divs) - 1]; $item['timestamp'] = strtotime($element->find('.author time', 0)->datetime); diff --git a/lib/FeedItem.php b/lib/FeedItem.php index bd37f119398..fc4549a7b5f 100644 --- a/lib/FeedItem.php +++ b/lib/FeedItem.php @@ -178,7 +178,6 @@ public function setAuthor($author) } else { $this->author = $author; } - return $this; } public function getContent(): ?string @@ -284,7 +283,6 @@ public function addMisc($name, $value) } else { $this->misc[$name] = $value; } - return $this; } public function toArray(): array diff --git a/lib/http.php b/lib/http.php index e4f9bf482ae..39f0c72710f 100644 --- a/lib/http.php +++ b/lib/http.php @@ -331,7 +331,14 @@ public function getHeader(string $name, bool $all = false) return array_pop($header); } - public function withBody(string $body): Response + public function withHeader(string $name, string $value): self + { + $clone = clone $this; + $clone->headers[$name] = [$value]; + return $clone; + } + + public function withBody(string $body): self { $clone = clone $this; $clone->body = $body;