Update authorization headers

For gitea API AuthorizationHeaderToken tokens must be prepended with "token" followed by a space, also fix content type
This commit is contained in:
2025-10-30 12:31:07 +01:00
parent ed2847a2c6
commit 244160e20e

View File

@@ -75,7 +75,7 @@ func StatusProxy(w http.ResponseWriter, r *http.Request) {
return return
} }
if !strings.EqualFold(token_arr[0], "Bearer") { if !strings.EqualFold(token_arr[0], "token") {
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
return return
} }
@@ -131,8 +131,8 @@ func StatusProxy(w http.ResponseWriter, r *http.Request) {
return return
} }
req.Header.Add("Content-Type", "Content-Type") req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", ForgeToken)) req.Header.Add("Authorization", fmt.Sprintf("token %s", ForgeToken))
resp, err := client.Do(req) resp, err := client.Do(req)