Closed
Description
Expected Behavior
from cloudevents.http import from_http
headers = {"ce-specversion": "1.0", "type": "me.type", "source": "<my-source>"}
from_http(headers, None)
I would expect the above code to raise cloudevents.exceptions.MissingRequiredFields("...")
Actual Behavior
Instead it does raise cloudevents.exceptions.InvalidStructuredJSON("...")
I believe it does this because line 48 we check whether headers is binary and if not we assume this is a structured request and try to read as json.
Perhaps instead of raising InvalidStructuredJSON we should set specversion to None and outside the if statement raise MissingRequiredFields('can't find specversion and couldn't decode json').
Metadata
Metadata
Assignees
Labels
No labels