Skip to content

Commit

Permalink
Merge pull request #10 from mittwald/fix/default-options-order
Browse files Browse the repository at this point in the history
fix: fix ordering of default options
  • Loading branch information
martin-helmich authored Feb 6, 2025
2 parents a9b722e + 94152e2 commit 59225a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mittwaldv2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 59225a3

Please sign in to comment.