Skip to content

is_binary and is_structured should be in http module #92

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 11, 2020 · 3 comments
Closed

is_binary and is_structured should be in http module #92

cumason123 opened this issue Aug 11, 2020 · 3 comments

Comments

@cumason123
Copy link
Contributor

Expected Behavior

from cloudevents.http import is_binary, is_structured

Actual Behavior

from cloudevents.sdk.converters import is_binary, is_structured

These methods at the moment comform to the http spec but aren't generalized to other specs. Therefore we would want to move these methods into the http module

@grayside
Copy link

I thought the purpose of structured events was to more easily pass CloudEvents in a transport agnostic manner. If so, shouldn't the API be shaped towards that use case?

@cumason123
Copy link
Contributor Author

A user does not need to know if the event is structured or binary when creating a cloudevent with this framework. For example, this sample server will internally decipher both binary and structured events.

There may exist a use case in which a user may want to determine if some request is binary or structured (possibly testing/debugging purposes). Additionally, I'm not all too familiar with the other protocols but I suspect the current implementations for is_binary and is_structured are oriented towards http specific fields. Therefore I wanted to export these fields to the http module. Such that a user could easily access these methods if they wanted to do so, and the methods are in the more appropriate http namespace.

Let me know if that addressed your question!

@grayside
Copy link

After further conversation, I understand that binary and structured events are defined per transport type, so including them in http makes sense.

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

2 participants