header加token

This commit is contained in:
junleea 2025-03-05 19:59:40 +08:00
parent ccf1916e4e
commit af83caeaa4
2 changed files with 2 additions and 5 deletions

View File

@ -105,11 +105,6 @@ func JWTAuthMiddleware() gin.HandlerFunc {
if tokenString == "" {
tokenString = c.Query("token")
}
//测试
if strings.Contains(c.Request.URL.Path, "/shell/") {
log.Printf("req token:%s ,path:%s", tokenString, c.Request.URL.Path)
}
//如果请求为login或register则不需要验证token
for k, _ := range proto.Url_map {
if strings.Contains(c.Request.URL.Path, k) {

View File

@ -211,6 +211,7 @@ func SyncDataFromMasterShellReq2(url string, data proto.SyncUserShellReq) ([]dao
return res, err
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("token", data.Token)
//传输数据
if client == nil {
client = &http.Client{}
@ -254,6 +255,7 @@ func SyncDataFromMasterShellReq3(url string, data proto.SyncUserShellResp) ([]pr
return res, err
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("token", data.Token)
//传输数据
if client == nil {
client = &http.Client{}