6 Commits
Author SHA1 Message Date
Sebastiaan van Stijn b8a569e7f6 client: add WithHTTPRequestHook option
Add WithHTTPRequestHook to allow callers to inspect outgoing HTTP requests
and modify request metadata before they are sent to the daemon.

Request hooks receive a clone of the original request so that modifications
made by hooks do not mutate the request passed to the client's RoundTripper.
Changes made by hooks are preserved on the request passed to the underlying
transport.

Protect request bodies while hooks are running, preventing hooks from reading
or closing the body while restoring the original body before the request is
sent. Hooks are invoked in registration order and may return an error to abort
the request.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-01 17:31:54 +02:00
Sebastiaan van Stijn 1bb13378c5 client: update examples
- Move "Example" tests separate so that we can use the actual import
- Add "WithUserAgent" in the examples, which should be best practice

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-12 18:53:41 +01:00
Sebastiaan van Stijn 189942570a client: enable API-version negotiation by default
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-27 13:52:27 +01:00
Sebastiaan van Stijn 2729703967 client: fix example in README (align with ExampleNew())
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-12 20:31:04 +01:00
Sebastiaan van Stijn d1f70d4f54 client: deprecate NewClientWithOpts in favor of New
Use a more idiomatic name so that it can be used as `client.New()`.

We should look if we want `New()` to have different / updated defaults
i.e., enable `WithEnv` as default, and have an opt-out and have API-
version negotiation enabled by default (with an opt-out option).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-30 18:09:44 +01:00
Sebastiaan van Stijn 3c62b06de2 client: fix example, and add runnable example
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 15:16:58 +01:00