Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

  • Add test for invalid gzip data with "content-encoding: gzip" header
  • Add test for successfully decompressed data that fails UTF-8 decoding
  • Add test for edge case where content-encoding header has different casing (e.g., "GZIP", "Gzip")
  • Run tests to validate changes
  • Final code review

Summary

Successfully added comprehensive test coverage for all three error handling scenarios in the gzip decompression logic as requested in the review feedback. All 24 integration tests pass, including the 3 new tests.

Tests Added

  1. test_invalid_gzip_data_with_gzip_header - Verifies graceful fallback when response claims to be gzipped but contains invalid gzip data
  2. test_gzip_decompressed_data_fails_utf8_decoding - Verifies handling when valid gzip data decompresses but contains non-UTF-8 bytes
  3. test_gzip_header_case_insensitive - Verifies case-insensitive handling of content-encoding header values

Code Review Note

The automated code review identified a potential optimization in the implementation where re-compressing already-decompressed data could be avoided by storing the original body. However, this is an implementation detail separate from the test coverage request and can be addressed in a follow-up if needed.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Add comprehensive test coverage for edge cases in gzip handling:
- Invalid gzip data with content-encoding: gzip header
- Valid gzip data that fails UTF-8 decoding after decompression
- Case-insensitive content-encoding header matching (GZIP, GzIp)

Co-authored-by: JacobCoffee <45884264+JacobCoffee@users.noreply.github.com>
@JacobCoffee JacobCoffee marked this pull request as ready for review December 28, 2025 03:31
@JacobCoffee JacobCoffee merged commit 6be939f into fix/gzip-compression-injection Dec 28, 2025
@JacobCoffee JacobCoffee deleted the copilot/sub-pr-24-again branch December 28, 2025 03:31
Copilot AI requested a review from JacobCoffee December 28, 2025 03:31
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