Skip to content

from_http doesn't accept capitalized required arguments nor None data #105

Closed
@cumason123

Description

@cumason123

Expected Behavior

from cloudevents.http import from_http
headers = {
    "Ce-Source": "<my-source>",
    "Ce-Specversion": "1.0",
    "Ce-Type": "my-type",
    "Ce-Id": str(uuid4())
}
from_http("", headers)

should pass despite upper-cased attributes names.

from cloudevents.http import from_http
headers = {
    "ce-source": "<my-source>",
    "ce-specversion": "1.0",
    "ce-type": "my-type",
    "ce-id": str(uuid4())
}
from_http(None, headers)

likewise, this should return an event with data set to none.

Actual Behavior

None data causes _json_or_string to fail, Recommend addding a None if statement in that function.

Capitalized ce-specversion isn't read by from_http. Instead, from_http should make all keys lower case before passing it into future functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions