Skip to content

Commit 0c9c5ae

Browse files
committed
Http binary wip
Signed-off-by: Fabio José <[email protected]>
1 parent 4d79e11 commit 0c9c5ae

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

lib/bindings/http/binary_0_1.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ HTTPBinary.prototype.emit = function(cloudevent){
1818
_headers["Content-Type"] = cloudevent.getContenttype();
1919

2020
_headers["CE-EventType"] = cloudevent.getType();
21+
_headers["CE-EventTypeVersion"] = cloudevent.getEventTypeVersion();
2122
_headers["CE-CloudEventsVersion"] = cloudevent.getSpecversion();
2223

2324
_headers["CE-Source"] = cloudevent.getSource();

lib/specs/spec_0_1.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ function Spec01(_caller){
1515
* Inject the method to set the version related to data attribute.
1616
*/
1717
this.caller.prototype.eventTypeVersion = function(_version){
18-
this.spec.eventTypeVersion(_version);
18+
return this.spec.eventTypeVersion(_version);
19+
};
20+
21+
this.caller.prototype.getEventTypeVersion = function(){
22+
return this.spec.getEventTypeVersion();
1923
};
2024
}
2125

@@ -50,6 +54,10 @@ Spec01.prototype.eventTypeVersion = function(version){
5054
return this;
5155
};
5256

57+
Spec01.prototype.getEventTypeVersion = function() {
58+
return this.payload["eventTypeVersion"];
59+
};
60+
5361
Spec01.prototype.source = function(_source){
5462
this.payload["source"] = _source;
5563
return this;

test/http_binding_0_1.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ var cloudevent =
2727
.schemaurl(schemaurl)
2828
.data(data);
2929

30+
cloudevent.eventTypeVersion("1.0.0");
31+
3032
var httpcfg = {
3133
method : "POST",
3234
url : webhook + "/json"

0 commit comments

Comments
 (0)