Skip to content

Commit

Permalink
chore(knative): Fix Http CloudEvent headers
Browse files Browse the repository at this point in the history
  • Loading branch information
christophd committed Feb 16, 2024
1 parent ff97bb3 commit 84c61ba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ public static CloudEvent v1_0() {
*/
public enum Attribute {

ID("ce-id", "id"),
SOURCE("ce-source", "source"),
SPEC_VERSION("ce-specversion", "specversion", "1.0"),
TYPE("ce-type", "type"),
SUBJECT("ce-subject", "subject"),
DATA_SCHEMA("ce-dataschema", "dataschema"),
TIME("ce-time", "time"),
ID("Ce-Id", "id"),
SOURCE("Ce-Source", "source"),
SPEC_VERSION("Ce-Specversion", "specversion", "1.0"),
TYPE("Ce-Type", "type"),
SUBJECT("Ce-Subject", "subject"),
DATA_SCHEMA("Ce-Dataschema", "dataschema"),
TIME("Ce-Time", "time"),
CONTENT_TYPE("Content-Type", "datacontenttype");

private final String http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static CloudEventMessage createEventMessage(String eventData, Map<String,
.forEach(entry -> {
Optional<CloudEvent.Attribute> attribute = CloudEvent.v1_0().attributes()
.stream()
.filter(a -> a.http().equals(entry.getKey()) || a.json().equals(entry.getKey()))
.filter(a -> a.http().equalsIgnoreCase(entry.getKey()) || a.json().equals(entry.getKey()))
.findFirst();

if (attribute.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public EndpointAdapter handleCloudEventAdapter() {
return new StaticEndpointAdapter() {
@Override
protected Message handleMessageInternal(Message message) {
Assertions.assertThat(message.getHeader("ce-id")).isEqualTo("say-hello");
Assertions.assertThat(message.getHeader("ce-specversion")).isEqualTo("1.0");
Assertions.assertThat(message.getHeader("ce-subject")).isEqualTo("hello");
Assertions.assertThat(message.getHeader("ce-type")).isEqualTo("greeting");
Assertions.assertThat(message.getHeader("ce-source")).isEqualTo("https://github.com/citrusframework/yaks");
Assertions.assertThat(message.getHeader("Ce-Id")).isEqualTo("say-hello");
Assertions.assertThat(message.getHeader("Ce-Specversion")).isEqualTo("1.0");
Assertions.assertThat(message.getHeader("Ce-Subject")).isEqualTo("hello");
Assertions.assertThat(message.getHeader("Ce-Type")).isEqualTo("greeting");
Assertions.assertThat(message.getHeader("Ce-Source")).isEqualTo("https://github.com/citrusframework/yaks");
Assertions.assertThat(message.getHeader("Content-Type").toString()).isEqualTo(MediaType.APPLICATION_JSON_UTF8_VALUE);
Assertions.assertThat(message.getPayload(String.class)).isEqualTo("{\"msg\": \"Hello Knative!\"}");

Expand Down

0 comments on commit 84c61ba

Please sign in to comment.