Skip to content

BinaryHTTPReceiver should remove datacontentencoding property after decoding  #284

Closed
@lance

Description

@lance

Describe the Bug
When the BinaryHTTPReceiver accepts an incoming event, one of the first things it does is check to see if the event has its data encoded, by looking for the CloudEvent#datacontentencoding property. If the data is encoded, and the content type is application/json, then it will parse the data so that to the user, it ultimately is in Object form.

However, when validating the event, the validator checks to see if the datacontentencoding is set and if so, will throw a ValidationError if it's not a string or Buffer.

This is only relevant for v0.3 events, since datacontentencoding is not part of the 1.0 specification.

Steps to Reproduce

  1. pull in the changes from chore: Update examples to use latest sdk changes #282
  2. run the example with "A Binary One with Base 64 Encoding" from the example README
  3. watch it fail

Expected Behavior
The event should be accepted, created and validated without error.

Metadata

Metadata

Assignees

Labels

module/libRelated to the main source codemodule/transport/httpIssues related to the HTTP transport protocol implementationspec/0.3Support for spec v0.3type/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions