-
Notifications
You must be signed in to change notification settings - Fork 69
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
Conversation
@@ -1,7 +1,7 @@ | |||
var axios = require("axios"); | |||
|
|||
function HTTPBinary(configuration){ | |||
this.config = configuration; | |||
this.config = JSON.parse(JSON.stringify(configuration)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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
@@ -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)); |
There was a problem hiding this comment.
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.
@@ -1,7 +1,7 @@ | |||
var axios = require("axios"); | |||
|
|||
function HTTPStructured(configuration){ | |||
this.config = configuration; | |||
this.config = JSON.parse(JSON.stringify(configuration)); |
There was a problem hiding this comment.
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.
@@ -1,7 +1,7 @@ | |||
var axios = require("axios"); | |||
|
|||
function HTTPStructured(configuration){ | |||
this.config = configuration; | |||
this.config = JSON.parse(JSON.stringify(configuration)); |
There was a problem hiding this comment.
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.
@playground-julia I've made some suggestions. Looking forward to your comments. |
Putting these changes in PR #15 and closing this. This was also not signed. |
Tests currently do not pass because the same config object is being used between the two bindings and the Content Type is being overridden. Changing the constructor to copy the config fixes this problem.