Skip to content

fix: name the missing required headers on binary HTTP requests - #303

Open
Sanjays2402 wants to merge 1 commit into
cloudevents:mainfrom
Sanjays2402:fix/binary-missing-header-error-message
Open

fix: name the missing required headers on binary HTTP requests#303
Sanjays2402 wants to merge 1 commit into
cloudevents:mainfrom
Sanjays2402:fix/binary-missing-header-error-message

Conversation

@Sanjays2402

@Sanjays2402 Sanjays2402 commented Aug 3, 2026

Copy link
Copy Markdown

Closes #139

Related Issue: #139

Type of change:

  • Bug fix (non-breaking change which fixes an issue)

Description:

A binary-mode request missing ce-id, ce-source or ce-type fails the binary converter's can_read check, so from_http falls through to the structured branch and reports Failed to find specversion in HTTP request even though ce-specversion is present — pointing at the wrong header.

from_http now names the required binary headers that are actually absent, but only when at least one of them is present; a request with no ce- headers at all is genuinely structured and keeps the existing message.


Pre-submission checklist:

  • I have read the CONTRIBUTING.md file.
  • I have signed off my commits using git commit --signoff.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the documentation (README.md, CHANGELOG.md, etc.) as necessary.
  • I have run pre-commit and tox and all checks pass.
  • This pull request is ready to be reviewed.

ruff check/ruff format are clean on the changed files and the new test fails without the fix and passes with it; tox's full matrix was not run locally (single interpreter available).

This change was prepared with AI assistance; the regression test was run locally and fails without the fix.

A binary-mode HTTP request that is missing ce-id, ce-source or ce-type
(but carries at least one ce- header) fails the binary converter's
can_read check, so from_http falls through to the structured branch and
reports "Failed to find specversion in HTTP request" even when
ce-specversion is present.

from_http now checks which of the four required binary headers are
absent when at least one of them is present, and names them in the
MissingRequiredFields message. A request with no binary headers at all
is genuinely structured and keeps the existing message.

Adds a regression test beside the existing binary missing-field tests
asserting each invalid header set names its own missing header.

Closes cloudevents#139

Signed-off-by: Sanjay Santhanam <51058514+Sanjays2402@users.noreply.github.com>
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.

cloudevents.http.from_http binary incorrect error messages

1 participant