fix: cors and content-type on error

This commit is contained in:
2023-12-22 14:24:11 +08:00
parent 04a2e4c12d
commit b1e3a97aad
3 changed files with 10 additions and 15 deletions

View File

@@ -14,7 +14,6 @@ func handleAuth(c *gin.Context) error {
authorization := c.Request.Header.Get("Authorization")
if !strings.HasPrefix(authorization, "Bearer") {
err = errors.New("authorization header should start with 'Bearer'")
c.AbortWithError(403, err)
return err
}
@@ -24,7 +23,6 @@ func handleAuth(c *gin.Context) error {
for _, auth := range strings.Split(config.Authorization, ",") {
if authorization != strings.Trim(auth, " ") {
err = errors.New("wrong authorization header")
c.AbortWithError(403, err)
return err
}
}