fix linter

This commit is contained in:
Pascal Fischer
2023-03-28 14:54:06 +02:00
parent 514403db37
commit 42ba0765c8
3 changed files with 7 additions and 3 deletions

View File

@@ -133,6 +133,11 @@ func (h *PATHandler) CreateToken(w http.ResponseWriter, r *http.Request) {
}
pat, err := server.CreateNewPAT(req.Name, req.ExpiresIn, user.Id)
if err != nil {
util.WriteError(err, w)
return
}
err = h.accountManager.AddPATToUser(account.Id, userID, &pat.PersonalAccessToken)
if err != nil {
util.WriteError(err, w)

View File

@@ -3,7 +3,6 @@ package http
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/http/httptest"
@@ -148,7 +147,7 @@ func TestTokenHandlers(t *testing.T) {
requestType: http.MethodPost,
requestPath: "/api/users/" + existingUserID + "/tokens",
requestBody: bytes.NewBuffer(
[]byte(fmt.Sprint("{\"name\":\"name\",\"expires_in\":7}"))),
[]byte("{\"name\":\"name\",\"expires_in\":7}")),
expectedStatus: http.StatusOK,
expectedBody: true,
},