diff --git a/api/http/handler/users/user_create_access_token.go b/api/http/handler/users/user_create_access_token.go index a2e63cf5c..673c0af76 100644 --- a/api/http/handler/users/user_create_access_token.go +++ b/api/http/handler/users/user_create_access_token.go @@ -50,7 +50,7 @@ type accessTokenResponse struct { // @produce json // @param id path int true "User identifier" // @param body body userAccessTokenCreatePayload true "details" -// @success 200 {object} accessTokenResponse "Created" +// @success 200 {object} accessTokenResponse "Success" // @failure 400 "Invalid request" // @failure 401 "Unauthorized" // @failure 403 "Permission denied" @@ -115,7 +115,7 @@ func (handler *Handler) userCreateAccessToken(w http.ResponseWriter, r *http.Req return httperror.InternalServerError("Internal Server Error", err) } - return response.JSONWithStatus(w, accessTokenResponse{rawAPIKey, *apiKey}, http.StatusCreated) + return response.JSONWithStatus(w, accessTokenResponse{rawAPIKey, *apiKey}, http.StatusOK) } func (handler *Handler) usesInternalAuthentication(userid portainer.UserID) (bool, error) { diff --git a/api/http/handler/users/user_create_access_token_test.go b/api/http/handler/users/user_create_access_token_test.go index 5199366a2..b7e49d96b 100644 --- a/api/http/handler/users/user_create_access_token_test.go +++ b/api/http/handler/users/user_create_access_token_test.go @@ -60,7 +60,7 @@ func Test_userCreateAccessToken(t *testing.T) { rr := httptest.NewRecorder() h.ServeHTTP(rr, req) - is.Equal(http.StatusCreated, rr.Code) + is.Equal(http.StatusOK, rr.Code) body, err := io.ReadAll(rr.Body) is.NoError(err, "ReadAll should not return error")