(c *gin.Context)
| 7 | ) |
| 8 | |
| 9 | func Authorization(c *gin.Context) { |
| 10 | if global.Authorization != "" { |
| 11 | authHeader := c.GetHeader("Authorization") |
| 12 | if authHeader == "" { |
| 13 | c.JSON(401, gin.H{"error": "Unauthorized"}) |
| 14 | c.Abort() |
| 15 | return |
| 16 | } |
| 17 | |
| 18 | if global.Authorization != strings.Replace(authHeader, "Bearer ", "", 1) { |
| 19 | c.JSON(401, gin.H{"error": "Unauthorized"}) |
| 20 | c.Abort() |
| 21 | return |
| 22 | } |
| 23 | } |
| 24 | c.Next() |
| 25 | } |
nothing calls this directly
no outgoing calls
no test coverage detected