emitter.send() drops datacontenttype header
See original GitHub issueNot entirely sure on this but I think emitter.send() drops the datacontenttype header.
structured
const event = new CloudEvent({
id: "4711",
type: "foo",
source: "bar",
datacontenttype: "text/xml",
data: "<xml>test</xml>"
});
emitter.send(event, { mode: "structured" }).then((response) => {
console.log(`status: ${response.status} ${response.statusText}`)
}).catch(console.error)
received content-type
header : “application/cloudevents+json”
received payload:
{
"data": "<xml>test</xml>",
"specversion": "1.0",
"id": "4711",
"time": "2020-07-06T06:56:01.645Z",
"source": "bar",
"type": "foo"
}
binary
const event = new CloudEvent({
id: "4711",
type: "foo",
source: "bar",
datacontenttype: "text/xml",
data: "<xml>test</xml>"
});
emitter.send(event, { mode: "binary" }).then((response) => {
console.log(`status: ${response.status} ${response.statusText}`)
}).catch(console.error)
received content-type
header = “application/json”
I assume the datacontenttype
is dropped (not allowed in binary binding). But then the missing value is defaulted to application/json for the content-type
header (seems correct from the spec). However, the content-type
header should be set to “text/xml” from the given datacontenttype
value.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Apache Kafka Reference Guide - Quarkus
Using the Emitter you are sending messages from your imperative code to reactive messaging. These messages are stored in a queue until they...
Read more >Writing Kafka Records - SmallRye Reactive Messaging
In the Kafka world, it's often necessary to send records, i.e. a key/value pair. ... withHeaders(new RecordHeaders().add("my-header", "value".
Read more >Spring SSE (SseEmitter): Flutter Client receiving events only ...
The problem is my Events aren't sent right after method send was called. They all come simultaneously (with same timestamp) to client only...
Read more >21. Web MVC framework - Spring
The get() method has a further @RequestMapping refinement: it only accepts GET ... In some other thread emitter.send("Hello once"); // and again later...
Read more >Release Notes for Red Hat build of Quarkus 2.2
In the following example, the hello() method uses a synchronous method ... To achieve this, you must use the emitter.send(instance).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@c-pius yes - the examples are previewing what will be coming in 3.0.0. You can track the release of that in this issue. We made this change to simplify marshaling/unmarshaling of
CloudEvent
objects, since the specification requires event attributes to be in all lowercase.ah okay, sorry for the confusion. Will this change with the new release however? I was looking at the examples and that is actually where I got the all lowercase
datacontenttype
fromhttps://github.com/cloudevents/sdk-javascript/blob/51035dc65b98ce7912d57a78d214612c05c5dc00/examples/typescript-ex/src/index.ts#L9