fix: name the missing required headers on binary HTTP requests - #303
Open
Sanjays2402 wants to merge 1 commit into
Open
fix: name the missing required headers on binary HTTP requests#303Sanjays2402 wants to merge 1 commit into
Sanjays2402 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #139
Related Issue: #139
Type of change:
Description:
A binary-mode request missing
ce-id,ce-sourceorce-typefails the binary converter'scan_readcheck, sofrom_httpfalls through to the structured branch and reportsFailed to find specversion in HTTP requesteven thoughce-specversionis present — pointing at the wrong header.from_httpnow names the required binary headers that are actually absent, but only when at least one of them is present; a request with noce-headers at all is genuinely structured and keeps the existing message.Pre-submission checklist:
git commit --signoff.README.md,CHANGELOG.md, etc.) as necessary.pre-commitandtoxand all checks pass.ruff check/ruff formatare 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.