Skip to content

is_binary should check more than just ce-specversion #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cumason123 opened this issue Aug 13, 2020 · 2 comments
Closed

is_binary should check more than just ce-specversion #95

cumason123 opened this issue Aug 13, 2020 · 2 comments

Comments

@cumason123
Copy link
Contributor

cumason123 commented Aug 13, 2020

Expected Behavior

from cloudevents.sdk.converters.binary import NewBinaryHTTPCloudEventConverter
cnvtr = NewBinaryHTTPCloudEventConverter()
assert not cnvtr.can_read({"ce-specversion": "1.0"})

Actual Behavior

cnvtr.can_read({"ce-specversion": "1.0"})

will return true because it only checks for ce-specversion and not other required versions.

@grayside
Copy link

Not sure I'm following: What's the difference between including the parameter and not?

@grant
Copy link
Member

grant commented Aug 13, 2020

Checking just one ce- header is fine in practice.

Checking:

req.header('ce-type') &&
req.header('ce-specversion') &&
req.header('ce-source') &&
req.header('ce-id')

for the require CE headers for binary encoding would be more robust and is what Node does.

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

No branches or pull requests

3 participants