Constants usage

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-06-11 12:56:49 -03:00
parent 404753f655
commit 1e17cf165f
2 changed files with 19 additions and 6 deletions

View File

@ -1,11 +1,18 @@
var axios = require("axios"); var axios = require("axios");
const Constants = require("./constants.js");
function HTTPStructured(configuration){ function HTTPStructured(configuration){
this.config = configuration; this.config = configuration;
this.config["headers"] = { if(!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;
} }
HTTPStructured.prototype.emit = function(cloudevent){ HTTPStructured.prototype.emit = function(cloudevent){

View File

@ -1,11 +1,17 @@
var axios = require("axios"); var axios = require("axios");
const Constants = require("./constants.js");
function HTTPStructured(configuration){ function HTTPStructured(configuration){
this.config = configuration; this.config = configuration;
this.config["headers"] = { if(!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;
} }
HTTPStructured.prototype.emit = function(cloudevent){ HTTPStructured.prototype.emit = function(cloudevent){