diff --git a/rest/wazuh.go b/rest/wazuh.go index dbe028f..b99334b 100644 --- a/rest/wazuh.go +++ b/rest/wazuh.go @@ -269,13 +269,6 @@ func NewClient(baseURL string, opts ...ClientOption) (*Client, error) { userAgent: "go-wazuh", } - // mutate client and add all optional params - for _, o := range opts { - if err := o(c); err != nil { - return nil, err - } - } - if c.ctx == nil { c.ctx = context.Background() } @@ -303,6 +296,13 @@ func NewClient(baseURL string, opts ...ClientOption) (*Client, error) { Transport: &t, } + // mutate client and add all optional params + for _, o := range opts { + if err := o(c); err != nil { + return nil, err + } + } + return c, nil }