Claus Ibsen created CAMEL-25970:
-----------------------------------

             Summary: camel-knative - a structured CloudEvent whose 
Content-Type has a charset is taken as binary, and the body is the whole 
envelope
                 Key: CAMEL-25970
                 URL: https://issues.apache.org/jira/browse/CAMEL-25970
             Project: Camel
          Issue Type: Bug
          Components: camel-knative
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


The knative consumer reads a structured CloudEvent only when the Content-Type 
header equals {{application/cloudevents+json}} exactly 
({{AbstractCloudEventProcessor}}, main e6885df7894d, line 64; 
{{Knative.MIME_STRUCTURED_CONTENT_MODE}}). A media type with a parameter, such 
as {{application/cloudevents+json; charset=UTF-8}}, is taken as binary mode: 
the body is the whole JSON envelope as bytes, and no attribute is mapped to the 
CloudEvent headers. The CloudEvents HTTP binding identifies the structured mode 
by the media type, whatever its parameters. The batch mode check at line 60 has 
the same problem.

Checked on 4.24.0-SNAPSHOT with {{camel run}} and a local environment file:
* with {{Content-Type: application/cloudevents+json}} the body is the data 
field, parsed ({{LinkedHashMap}} {{\{id=7\}}}), and CamelCloudEventType is set;
* with {{Content-Type: application/cloudevents+json; charset=UTF-8}} the body 
is the bytes of the envelope, and CamelCloudEventType is not set.

*Proposed change*: compare the media type without its parameters, ignoring case.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to