-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add custom http.Client support. #53
Conversation
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.
@yunginnanet Thanks for the contribution 👏 Please have a look at my suggestions
Codecov Report
@@ Coverage Diff @@
## master #53 +/- ##
==========================================
+ Coverage 73.42% 73.53% +0.11%
==========================================
Files 5 5
Lines 1430 1436 +6
==========================================
+ Hits 1050 1056 +6
Misses 210 210
Partials 170 170
Continue to review full report at Codecov.
|
@yunginnanet Looks good 👍 Also, I’ve started working on version 2 with Bridge V2 API support. Would you be interested in helping out? #52 |
- What I did
Added the ability to use a custom http.Client when interacting with bridges. My particular use-case comes from all of my lighting being segmented off, this allows for me to use my router as a middle-man via an SSH tunnel. However, I feel there are many, many use-cases.
- How I did it
I created a new function similar to New called NewCustom, it is just about the same except for it allows you to pass in your own http.Client. I then refactored all of the unexported http functions (get, put etc) to be methods of Bridge. This allows them to function using http.DefaultClient during normal operations, but with the custom http.Client otherwise.
- How to verify it
I've not only verified that this works for my use-case, but frankly making the testcases work (I didn't realize how httpmock had worked until today) was more work than the modification itself. So I think CI does a pretty good job of verification :)
- Description for the CHANGELOG