From b51876a020b617d324a16c5f41d2480dff45ddbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Thu, 22 Aug 2019 17:21:00 -0300 Subject: [PATCH] Fixing the subject unmarshall: Closes #32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- lib/bindings/http/receiver_structured_0_3.js | 4 ++++ test/bindings/http/unmarshaller_0_3_tests.js | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/bindings/http/receiver_structured_0_3.js b/lib/bindings/http/receiver_structured_0_3.js index f5c04f1..45f0982 100644 --- a/lib/bindings/http/receiver_structured_0_3.js +++ b/lib/bindings/http/receiver_structured_0_3.js @@ -51,6 +51,10 @@ setterByAttribute[Constants.STRUCTURED_ATTRS_03.CONTENT_TYPE] = { name: "dataContentType", parser: (v) => v }; +setterByAttribute[Constants.STRUCTURED_ATTRS_03.SUBJECT] = { + name: "subject", + parser: (v) => v +}; setterByAttribute[Constants.STRUCTURED_ATTRS_03.DATA] = { name: "data", parser: (v) => v diff --git a/test/bindings/http/unmarshaller_0_3_tests.js b/test/bindings/http/unmarshaller_0_3_tests.js index 421b194..9304451 100644 --- a/test/bindings/http/unmarshaller_0_3_tests.js +++ b/test/bindings/http/unmarshaller_0_3_tests.js @@ -9,7 +9,7 @@ const webhook = "https://cloudevents.io/webhook"; const contentType = "application/cloudevents+json; charset=utf-8"; const now = new Date(); const schemaurl = "http://cloudevents.io/schema.json"; - +const subject = "subject.ext"; const ceContentType = "application/json"; const data = { @@ -118,9 +118,10 @@ describe("HTTP Transport Binding Unmarshaller for CloudEvents v0.3", () => { new Cloudevent(v03.Spec) .type(type) .source(source) - .contenttype(ceContentType) + .dataContentType(ceContentType) .time(now) .schemaurl(schemaurl) + .subject(subject) .data(data) .toString();