Skip to content

fix: honor zero content length#4

Merged
BunsDev merged 1 commit into
mainfrom
fix/content-length-zero
Jul 6, 2026
Merged

fix: honor zero content length#4
BunsDev merged 1 commit into
mainfrom
fix/content-length-zero

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Treat parsed CONTENT_LENGTH=0 as an empty request body.
  • Keep missing or unparsable content lengths on the bounded EOF-read path.
  • Add regression coverage for the zero-length WSGI case raised by Copilot on fix: address webhook review followups #3.

Verification

  • python3 -m unittest discover -s tests -v
  • python3 -m py_compile coven_github_adapter.py tests/test_webhook_adapter.py
  • git diff --check
  • scripts/smoke-webhook.sh http://127.0.0.1:8765/webhook smoke-secret

Copilot AI review requested due to automatic review settings July 6, 2026 11:00
@BunsDev BunsDev merged commit 9705d5e into main Jul 6, 2026
1 check passed
@BunsDev BunsDev deleted the fix/content-length-zero branch July 6, 2026 11:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the webhook WSGI request-body reader to correctly treat a parsed CONTENT_LENGTH=0 as an empty body (instead of falling back to an EOF read), and adds a regression test to cover that case. This keeps the adapter a thin, predictable forwarder while hardening a real-world edge case in WSGI environments.

Changes:

  • Treat CONTENT_LENGTH=0 as a valid length and read exactly 0 bytes from wsgi.input.
  • Preserve existing behavior for missing/unparsable CONTENT_LENGTH by keeping the bounded EOF-read path.
  • Add a regression unit test covering the zero-length content scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
coven_github_adapter.py Adjusts read_request_body to honor CONTENT_LENGTH=0 by using a fixed-length read.
tests/test_webhook_adapter.py Adds a unit test validating the zero-content-length behavior and expected 400 invalid json response.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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