Skip to content

feat(routes): let add_routes leave response bodies out of /cached-records - #95

Merged
allen0099 merged 1 commit into
masterfrom
feat/routes-omit-content-preview
Sep 25, 2026
Merged

allen0099 merged 1 commit into
masterfrom
feat/routes-omit-content-preview

Conversation

@allen0099

Copy link
Copy Markdown
Owner

Closes #79.

Change

add_routes() gains include_content_preview: bool = True. When it is False, every record in /cached-records has content_preview: null. Keys, sizes, ETags and expiry are still reported, and /cached-hits is unchanged (it never included bodies).

  • The default stays True, so existing callers see no change. Whether it should flip to False in 0.4.0 remains the open question in the issue.
  • The CachedRecord.content_preview field type widens from str to str | None.
  • docs/HTTP_CACHING.md shows the option in the example and mentions it in the route description and the no-authentication warning. [Unreleased] has an Added entry.

Tests

  • New test_cached_records_can_omit_content_preview:
    • The preview is null, and the body string appears nowhere in the response.
    • Path, size and ttl are still reported.
  • Local results:
    • Full suite against the throwaway Redis (6380) and Memcached (11212) test servers: 690 passed, 1 skipped, coverage 100%.
    • ruff, mypy --strict and zensical build --strict are clean.

Note

This PR and #94 both edit [Unreleased] in CHANGELOG.md: #94 adds a ### Fixed section and this PR adds to ### Added. The edits are in different places, so they should merge cleanly.

…ords

add_routes(..., include_content_preview=False) sets content_preview to
null, so a deployment can expose the key listing, sizes and expiry without
exposing the first 100 bytes of every cached response. The default stays
True, so existing callers see no change.

Closes #79
@allen0099
allen0099 merged commit ceafecc into master Sep 25, 2026
10 checks passed
@allen0099
allen0099 deleted the feat/routes-omit-content-preview branch September 25, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add_routes: option to omit content previews from /cached-records

1 participant