Skip to content

Commit

Permalink
add "Bearer" header
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Oct 2, 2023
1 parent badb7bd commit 1c4e613
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions middleware/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func AuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
k := strings.TrimSpace(c.GetHeader("Authorization"))
if k != "" {
if strings.HasPrefix(k, "Bearer ") {
k, _ = strings.CutPrefix(k, "Bearer ")
}

if strings.HasPrefix(k, "sk-") { // api agent
if ProcessKey(c, k) {
return
Expand Down

0 comments on commit 1c4e613

Please sign in to comment.