Skip to content

Make a copy of configuration being passed in #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/bindings/http/binary_0_1.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var axios = require("axios");

function HTTPBinary(configuration){
this.config = configuration;
this.config = JSON.parse(JSON.stringify(configuration));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check out the line #14. I suggest you remove this copy because it is useless.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw line #14. I don't think it's useless because the config object is being changed in line 6/7. That's what is causing npm test to fail...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make more sense if you look at my other pull request first. #15


this.config["headers"] = {
"Content-Type":"application/cloudevents+json; charset=utf-8"
Expand Down
2 changes: 1 addition & 1 deletion lib/bindings/http/binary_0_2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the line #15. The same way.


this.config["headers"] = {
"Content-Type":"application/cloudevents+json; charset=utf-8"
Expand Down
3 changes: 2 additions & 1 deletion lib/bindings/http/structured_0_1.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var axios = require("axios");

function HTTPStructured(configuration){
this.config = configuration;
this.config = JSON.parse(JSON.stringify(configuration));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the line #14. Same suggestion.


this.config["headers"] = {
"Content-Type":"application/cloudevents+json; charset=utf-8"
Expand All @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion lib/bindings/http/structured_0_2.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var axios = require("axios");

function HTTPStructured(configuration){
this.config = configuration;
this.config = JSON.parse(JSON.stringify(configuration));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the line #14.


this.config["headers"] = {
"Content-Type":"application/cloudevents+json; charset=utf-8"
Expand Down