-
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
Allow configuration of underlying HTTP client. #97
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Can one of the admins verify this patch? |
markylaing
commented
Jun 9, 2022
jameinel
approved these changes
Jun 16, 2022
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'm ok with the change, it seems a little weird to always copy the http.Client, but it certainly isn't wrong at this point.
Adds a HTTPClient field containing a *http.Client to the gomaasapi.Client and uses it for requests if non-nil. Signed-off-by: Mark Laing <mark.laing@canonical.com>
Adds a HTTPClient field to ControllerArgs and sets the client.HTTPClient to the given value. If no http client is provided, the gomaasapi.Client will instantiate it's own client per request. Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Sets a delay on the test server and a timeout on the HTTP client provided to the client such that a timeout is forced. Asserts that the returned error is a context deadline exceeded. Signed-off-by: Mark Laing <mark.laing@canonical.com>
markylaing
force-pushed
the
configurable-http-client
branch
from
June 16, 2022 08:29
dd8bf9f
to
c66030f
Compare
/build |
1 similar comment
/build |
/merge |
1 similar comment
/merge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Allows a user to pass a HTTP client in to the controller, to be used for making requests to the MAAS API. If no HTTP client is provided on controller creation, a new HTTP client is instantiated for each request (this is the same as previous behaviour).
This allows a user to configure TLS between self-signed servers, or to set request timeouts.
The changes are tested by forcing a timeout error on a request to the test server.