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"