-
Notifications
You must be signed in to change notification settings - Fork 6
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
Code for the juju http wrapper package. #1
Conversation
Makefile
Outdated
# Reformat source files. | ||
format: | ||
## format: Format the go source code | ||
gofmt -w -l . |
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.
nit: new line at end of file.
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.
done
// a Client with a locally constructed Transport via NewHttpTLSTransport | ||
// and init() will no longer be needed. | ||
func init() { | ||
defaultTransport := http.DefaultTransport.(*http.Transport) |
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.
Can we remove this init()
function, it's considered an anti-pattern?
Also, this modifies every http.DefaultTransport
and I'm pretty sure we don't want to do that...!
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.
Also, nobody is using defaultTransport
locally.
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.
defaultTransport is used for an argument with the function calls after. Unfortunately we need this to get some transport changes in for juju. juju tests currently require being able to change the DefaultTransport to add different schemes for test and replace the RoundTripper. Updating the tests needs to be done, but make take weeks of effort which we do not have at this time. Small updates can be make to use httptest instead and chip away at the problem. The follow on pr in juju/juju starts that.
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.
Can we add a LP bug, this makes me sad.
dc40df1
to
a436e6c
Compare
@SimonRichardson, agreed, makes me sad as well. https://bugs.launchpad.net/juju/+bug/1888888. |
This code has been moved from juju/utils with a few differences: there is one constructure which takes a config; does not cache proxy settings; uses httptrace on http.Get methods.
!!build!! |
Looking to creating a merge job and check merge job for this repo. Then will merge. |
!!build!! |
1 similar comment
!!build!! |
Build finished. |
|
Build finished. |
|
This code has been moved from juju/utils with a few differences: there is one constructer which takes a config, including the ability to pass a logger; it does not cache proxy settings; and uses httptrace on http.Get methods when trace logging enabled.