-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix incorrect error messages for from_http() #143
Conversation
This PR is missing tests covering the actual issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
The spec states that binary CEs have required attributes in the headers.
There are 4 required attributes:
https://github.com/cloudevents/spec/blob/v1.0/spec.md#required-attributes
I'm not seeing how this fixes an issue with the function.
The goal of the SDKs aren't to align to each other, but rather the CE spec. I'm a bit confused why this is mentioned here. |
I think the complaint here is that the error message when it fails to parse is not very helpful? By removing the extra conditions on trying to process the message as a binary encoding, we are able to provide a more helpful error about missing required attributes, rather than instead trying to process it as structured. |
Had there been a test included with this, this would have been clearer. :P |
Making the error message better sounds good. However, I don't see this PR fixing #139, so I'm inclined we modify the PR or close it. :) |
5c066c2
to
c0ac91f
Compare
add tests fix lint Signed-off-by: XinYang <[email protected]>
4ad6161
to
9cbb539
Compare
PTAL, I added a test case
Before modification, all http requests with missing necessary headers will be judged as structured content mode(but in fact is binary mode),and than raise an error in L65-L67( After modification, the http requests with missing necessary headers will throw an error through L76-L78 sdk-python/cloudevents/http/http_methods.py Lines 46 to 78 in 705e8b4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the 4 required CE fields should be check and required.
and "ce-source" in headers | ||
and "ce-type" in headers | ||
and "ce-id" in headers | ||
or "ce-source" in headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these headers are required for binary CEs.
Perhaps come to CloudEvent WG to talk about the PR? |
Hi @xinydev, lmk if you're still working on this. I left some comments from before. |
I'm very sorry, I don't have enough time to continue doing this recently. |
Fixes #139
Align the logic of
has_binary_headers()
with sdk-goUsing
ce-specversion
is enough.Changes
One line description for the changelog