Constants usage

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-06-11 12:42:04 -03:00
parent 6de756d102
commit f4c86d460e
1 changed files with 8 additions and 4 deletions

View File

@ -1,11 +1,15 @@
var axios = require("axios");
const Constants = require("./constants.js");
function HTTPBinary(configuration){
this.config = configuration;
this.config["headers"] = {
"Content-Type":"application/cloudevents+json; charset=utf-8"
};
this.config["headers"] = {};
this.config["headers"]
[Constants.HEADER_CONTENT_TYPE] =
Constants.MIME_CE_JSON + "; charset=" + Constants.CHARSET_DEFAULT;
}
HTTPBinary.prototype.emit = function(cloudevent){
@ -17,7 +21,7 @@ HTTPBinary.prototype.emit = function(cloudevent){
var _headers = _config["headers"];
if(cloudevent.getContenttype()) {
_headers["Content-Type"] = cloudevent.getContenttype();
_headers[Constants.HEADER_CONTENT_TYPE] = cloudevent.getContenttype();
}
_headers["CE-EventType"] = cloudevent.getType();