mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-13 14:29:05 +02:00
20 lines
256 B
Go
20 lines
256 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func auth(c *gin.Context) {
|
|
id := c.Request.Header.Get("id")
|
|
if id == "" {
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": "no id provided"})
|
|
c.Abort()
|
|
}
|
|
|
|
c.Set("id", id)
|
|
c.Next()
|
|
|
|
}
|