From 94152e2442356900376717fdf915502397f49f55 Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Thu, 6 Feb 2025 21:23:00 +0100 Subject: [PATCH] fix: fix ordering of default options --- mittwaldv2/client.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mittwaldv2/client.go b/mittwaldv2/client.go index 32bfa39f..62880de8 100644 --- a/mittwaldv2/client.go +++ b/mittwaldv2/client.go @@ -22,9 +22,12 @@ func New(ctx context.Context, opts ...ClientOption) (generatedv2.Client, error) var runner httpclient.RequestRunner = http.DefaultClient var err error + // caution, this is counter-intuitive: since the options are basically a chain of wrappers around the actual + // request runner, they run inside-out and the options added _last_ will be applied _first_. This is why the default + // options need to come last. allOpts := append( - defaultOpts[:], - opts..., + opts, + defaultOpts[:]..., ) for _, o := range allOpts {