Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/App/FeedController/RSSFeedController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension RSSFeedController {
private func buildRSSXML(posts: [FeedPost]) -> String {
var xml = """
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Michael Nisi</title>
<link>https://michaelnisi.com</link>
Expand All @@ -79,6 +79,7 @@ extension RSSFeedController {
<link>\(post.url)</link>
<guid isPermaLink="true">\(post.url)</guid>
<pubDate>\(pubDate)</pubDate>
<dc:creator>Michael Nisi</dc:creator>
<description>\(post.description.xmlEscaped)</description>
<content:encoded><![CDATA[\(post.html)]]></content:encoded>
</item>
Expand Down
11 changes: 11 additions & 0 deletions Tests/AppTests/FeedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ struct FeedTests {
}
}

@Test("GET /feed items include dc:creator author name")
func rssFeedItemsIncludeAuthor() async throws {
let app = try await buildApplication(TestArguments())
try await app.test(.router) { client in
try await client.execute(uri: "/feed", method: .get) { response in
let body = String(buffer: response.body)
#expect(body.contains("<dc:creator>Michael Nisi</dc:creator>"))
}
}
}

@Test("GET /feed with If-None-Match returns 304")
func rssFeedConditionalGet() async throws {
let app = try await buildApplication(TestArguments())
Expand Down
Loading