From b60454234b1c29df553cf82192ede76b233aa295 Mon Sep 17 00:00:00 2001 From: Julia Huang Date: Tue, 11 Jun 2019 14:22:47 -0700 Subject: [PATCH] Make a copy of configuration being passed in - tests should now be passing Signed-off-by: Julia Huang --- lib/bindings/http/binary_0_1.js | 2 +- lib/bindings/http/binary_0_2.js | 2 +- lib/bindings/http/structured_0_1.js | 3 ++- lib/bindings/http/structured_0_2.js | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/bindings/http/binary_0_1.js b/lib/bindings/http/binary_0_1.js index 4bca1a5..240401c 100644 --- a/lib/bindings/http/binary_0_1.js +++ b/lib/bindings/http/binary_0_1.js @@ -1,7 +1,7 @@ var axios = require("axios"); function HTTPBinary(configuration){ - this.config = configuration; + this.config = JSON.parse(JSON.stringify(configuration)); this.config["headers"] = { "Content-Type":"application/json; charset=utf-8" diff --git a/lib/bindings/http/binary_0_2.js b/lib/bindings/http/binary_0_2.js index 916d538..822bf41 100644 --- a/lib/bindings/http/binary_0_2.js +++ b/lib/bindings/http/binary_0_2.js @@ -2,7 +2,7 @@ var axios = require("axios"); var empty = require("is-empty"); function HTTPBinary(configuration){ - this.config = configuration; + this.config = JSON.parse(JSON.stringify(configuration)); this.config["headers"] = { "Content-Type":"application/json; charset=utf-8" diff --git a/lib/bindings/http/structured_0_1.js b/lib/bindings/http/structured_0_1.js index 65c6530..cf35282 100644 --- a/lib/bindings/http/structured_0_1.js +++ b/lib/bindings/http/structured_0_1.js @@ -1,7 +1,7 @@ var axios = require("axios"); function HTTPStructured(configuration){ - this.config = configuration; + this.config = JSON.parse(JSON.stringify(configuration)); this.config["headers"] = { "Content-Type":"application/cloudevents+json; charset=utf-8" @@ -13,6 +13,7 @@ HTTPStructured.prototype.emit = function(cloudevent){ // Create new request object var _config = JSON.parse(JSON.stringify(this.config)); + // Set the cloudevent payload _config["data"] = cloudevent.format(); diff --git a/lib/bindings/http/structured_0_2.js b/lib/bindings/http/structured_0_2.js index 65c6530..fd45956 100644 --- a/lib/bindings/http/structured_0_2.js +++ b/lib/bindings/http/structured_0_2.js @@ -1,7 +1,7 @@ var axios = require("axios"); function HTTPStructured(configuration){ - this.config = configuration; + this.config = JSON.parse(JSON.stringify(configuration)); this.config["headers"] = { "Content-Type":"application/cloudevents+json; charset=utf-8"