From 0c9c5ae512d49c5cf9550ede6f7c284ec69f983f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Mon, 17 Dec 2018 21:21:09 -0200 Subject: [PATCH] Http binary wip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- lib/bindings/http/binary_0_1.js | 1 + lib/specs/spec_0_1.js | 10 +++++++++- test/http_binding_0_1.js | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/bindings/http/binary_0_1.js b/lib/bindings/http/binary_0_1.js index 2454ec3..7cbe2ed 100644 --- a/lib/bindings/http/binary_0_1.js +++ b/lib/bindings/http/binary_0_1.js @@ -18,6 +18,7 @@ HTTPBinary.prototype.emit = function(cloudevent){ _headers["Content-Type"] = cloudevent.getContenttype(); _headers["CE-EventType"] = cloudevent.getType(); + _headers["CE-EventTypeVersion"] = cloudevent.getEventTypeVersion(); _headers["CE-CloudEventsVersion"] = cloudevent.getSpecversion(); _headers["CE-Source"] = cloudevent.getSource(); diff --git a/lib/specs/spec_0_1.js b/lib/specs/spec_0_1.js index aca4164..b458642 100644 --- a/lib/specs/spec_0_1.js +++ b/lib/specs/spec_0_1.js @@ -15,7 +15,11 @@ function Spec01(_caller){ * Inject the method to set the version related to data attribute. */ this.caller.prototype.eventTypeVersion = function(_version){ - this.spec.eventTypeVersion(_version); + return this.spec.eventTypeVersion(_version); + }; + + this.caller.prototype.getEventTypeVersion = function(){ + return this.spec.getEventTypeVersion(); }; } @@ -50,6 +54,10 @@ Spec01.prototype.eventTypeVersion = function(version){ return this; }; +Spec01.prototype.getEventTypeVersion = function() { + return this.payload["eventTypeVersion"]; +}; + Spec01.prototype.source = function(_source){ this.payload["source"] = _source; return this; diff --git a/test/http_binding_0_1.js b/test/http_binding_0_1.js index 89278ae..38e6a0c 100644 --- a/test/http_binding_0_1.js +++ b/test/http_binding_0_1.js @@ -27,6 +27,8 @@ var cloudevent = .schemaurl(schemaurl) .data(data); +cloudevent.eventTypeVersion("1.0.0"); + var httpcfg = { method : "POST", url : webhook + "/json"