Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello
2 days ago i started to use this lib for consul and very quickly i ran into a weird error where papi was yelling at the baseUrl. After some digging i found out that your library is actually mutating the options object that one pass in. So when using the same options object twice in your codebase you get weird errors
example:
File 1
File 2
Here file 2 breaks on initialization since the the first constructor have mutated my config.consul object. This is easy to fix by just creating new object but it took me a while to figure out why papi was breaking. I also think it's good practice to handle options params as "immutable" to avoid side effects like this.
I added test to make sure the object is not referenced and updated the opts to use _.extend from user options params.
Not a major thing but this would have saved me some trouble so I hope you think it's a good idea