Extend client API with custom HTTP requests#37071
Conversation
|
I don't really see the context of why this would be needed in the mentioned issue. Also would it be better to add a method to get the HTTP client rather than having the API client itself perform the request? It seems weird to have the API client just do any random request. |
It might be a bit hard to follow with much of the context being lost due to the many rebases.
I really don't have enough experience with the design of moby and docker/CLI to answer that. |
|
@mat007 yeah having a exported method to get the client's http client would work too 👼 |
|
Or something to read the credentials. Is this just the tlsconfig? We could provide a copy of the tlsconfig easily enough. |
|
@cpuguy83 I changed the PR to now expose a |
client/client.go
Outdated
There was a problem hiding this comment.
Should this make a copy of the client?
There was a problem hiding this comment.
OK, I changed that. Still returning a pointer though as http.Client functions take a pointer as receptor and it's more convenient to directly get a pointer there.
Codecov Report
@@ Coverage Diff @@
## master #37071 +/- ##
=========================================
Coverage ? 35.09%
=========================================
Files ? 615
Lines ? 45820
Branches ? 0
=========================================
Hits ? 16080
Misses ? 27630
Partials ? 2110 |
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
- What I did
I made the client underlying HTTP client accessible, useful for instance for docker/cli#1034
- How I did it
Added a
HTTPClient()accessor to theClientinterface.- A picture of a cute animal (not mandatory but encouraged)