aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-02-16 23:03:41 +0000
committerClaude <noreply@anthropic.com>2026-02-16 23:03:41 +0000
commitf67c07b178cd90539f1cc934def5a99be203e44a (patch)
treeae8fd06bc8294029d39fb9c2cb73f12606d88e05 /api
parent2321d5bcf17e416244e75f5727f0710f9cdd9a1a (diff)
downloadneko-f67c07b178cd90539f1cc934def5a99be203e44a.tar.gz
neko-f67c07b178cd90539f1cc934def5a99be203e44a.tar.bz2
neko-f67c07b178cd90539f1cc934def5a99be203e44a.zip
Exclude full_content from stream list API responses
The /stream endpoint now skips selecting full_content and header_image from the database, reducing memory allocation and response payload size for list views. Full content remains available via /item/:id endpoint. Adds omitempty to JSON tags so empty fields are omitted from responses, and a test verifying full_content is excluded from stream responses. https://claude.ai/code/session_019Z4VJxzY7tcAuNkPAkvry9
Diffstat (limited to 'api')
-rw-r--r--api/api_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/api/api_test.go b/api/api_test.go
index 010908a..ada824b 100644
--- a/api/api_test.go
+++ b/api/api_test.go
@@ -445,6 +445,35 @@ func TestHandleStreamComplexFilters(t *testing.T) {
}
}
+func TestStreamExcludesFullContent(t *testing.T) {
+ setupTestDB(t)
+ server := newTestServer()
+
+ f := &feed.Feed{Url: "http://example.com/content", Title: "Content Feed"}
+ f.Create()
+ i := &item.Item{
+ Title: "Content Item",
+ Url: "http://example.com/content/1",
+ FeedId: f.Id,
+ }
+ _ = i.Create()
+ // Simulate having full_content stored in DB
+ models.DB.Exec("UPDATE item SET full_content=? WHERE id=?", "<p>Full article text</p>", i.Id)
+
+ // Stream response should NOT include full_content
+ req := httptest.NewRequest("GET", "/stream?read_filter=all", nil)
+ rr := httptest.NewRecorder()
+ server.HandleStream(rr, req)
+
+ body := rr.Body.String()
+ if strings.Contains(body, "Full article text") {
+ t.Error("stream response should not contain full_content")
+ }
+ if strings.Contains(body, `"full_content"`) {
+ t.Error("stream response should not contain full_content key")
+ }
+}
+
func TestHandleCategorySuccess(t *testing.T) {
setupTestDB(t)
server := newTestServer()