From 1e17cf165fbe9923ade02f041da076ff05647936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Tue, 11 Jun 2019 12:56:49 -0300 Subject: [PATCH] Constants usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- lib/bindings/http/emitter_structured_0_1.js | 13 ++++++++++--- lib/bindings/http/emitter_structured_0_2.js | 12 +++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/bindings/http/emitter_structured_0_1.js b/lib/bindings/http/emitter_structured_0_1.js index 65c6530..39f7a70 100644 --- a/lib/bindings/http/emitter_structured_0_1.js +++ b/lib/bindings/http/emitter_structured_0_1.js @@ -1,11 +1,18 @@ var axios = require("axios"); +const Constants = require("./constants.js"); + function HTTPStructured(configuration){ this.config = configuration; - this.config["headers"] = { - "Content-Type":"application/cloudevents+json; charset=utf-8" - }; + if(!this.config["headers"]){ + this.config["headers"] = {}; + } + + this.config["headers"] + [Constants.HEADER_CONTENT_TYPE] = + Constants.MIME_CE_JSON + "; charset=" + Constants.CHARSET_DEFAULT; + } HTTPStructured.prototype.emit = function(cloudevent){ diff --git a/lib/bindings/http/emitter_structured_0_2.js b/lib/bindings/http/emitter_structured_0_2.js index 65c6530..2031542 100644 --- a/lib/bindings/http/emitter_structured_0_2.js +++ b/lib/bindings/http/emitter_structured_0_2.js @@ -1,11 +1,17 @@ var axios = require("axios"); +const Constants = require("./constants.js"); + function HTTPStructured(configuration){ this.config = configuration; - this.config["headers"] = { - "Content-Type":"application/cloudevents+json; charset=utf-8" - }; + if(!this.config["headers"]){ + this.config["headers"] = {}; + } + + this.config["headers"] + [Constants.HEADER_CONTENT_TYPE] = + Constants.MIME_CE_JSON + "; charset=" + Constants.CHARSET_DEFAULT; } HTTPStructured.prototype.emit = function(cloudevent){