From f67c07b178cd90539f1cc934def5a99be203e44a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Feb 2026 23:03:41 +0000 Subject: 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 --- api/api_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'api') 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=?", "

Full article text

", 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() -- cgit v1.2.3