From 47cab1ebc275e311707e213221e2ee02edf2732d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Men=C3=A9ndez?= Date: Wed, 21 Aug 2024 13:03:04 +0200 Subject: [PATCH] prevent to return error when the apiclient user attempts to create an already registered token --- apiclient/tokens.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiclient/tokens.go b/apiclient/tokens.go index 17935b9..8cd776f 100644 --- a/apiclient/tokens.go +++ b/apiclient/tokens.go @@ -121,7 +121,7 @@ func (c *HTTPclient) CreateToken(token *api.Token) error { log.Errorf("error closing response body: %v", err) } }() - if res.StatusCode != http.StatusCreated && res.StatusCode != http.StatusOK { + if res.StatusCode != http.StatusCreated && res.StatusCode != http.StatusOK && res.StatusCode == http.StatusConflict { return fmt.Errorf("%w: %w", ErrNoStatusOk, fmt.Errorf("%d %s", res.StatusCode, http.StatusText(res.StatusCode))) } return nil