Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

Responded to review feedback requesting a GitHub issue be created to track support for additional compression formats (deflate, br, zstd) beyond the currently implemented gzip handling in toolbar injection middleware.

Changes

  • Provided formatted issue template with title, description, and context for manual creation
  • No code changes required - limitation documented for future enhancement

Context

The middleware at src/debug_toolbar/litestar/middleware.py:494-503 currently only decompresses gzip-encoded responses before toolbar injection. Other compression formats would result in silent failures where the toolbar isn't injected into compressed responses.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

JacobCoffee and others added 9 commits December 27, 2025 21:20
The debug toolbar middleware was failing to inject the toolbar HTML into
gzip-compressed responses. When Litestar's compression middleware runs
before the debug toolbar, the response body is gzip bytes, which cannot
be decoded as UTF-8. The middleware silently returned the original body
without injection.

This fix:
- Detects gzip content-encoding header
- Decompresses the response body before injection
- Injects the toolbar HTML into the decompressed HTML
- Returns uncompressed response (strips content-encoding header)

This ensures the toolbar is visible when compression is enabled, which
is the default in many production-like configurations.

Fixes toolbar not appearing on admin pages when compression is enabled.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: JacobCoffee <45884264+JacobCoffee@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix handling of gzip-compressed responses in toolbar Provide issue template for additional compression format support Dec 28, 2025
Copilot AI requested a review from JacobCoffee December 28, 2025 03:42
Base automatically changed from fix/gzip-compression-injection to main December 28, 2025 04:11
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.

2 participants