附近小店
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mw_change_header.go 339 B

2 달 전
123456789101112131415161718
  1. package mw
  2. import (
  3. "github.com/gin-gonic/gin"
  4. )
  5. // 修改传过来的头部字段
  6. func ChangeHeader(c *gin.Context) {
  7. appvserison := c.GetHeader("AppVersionName")
  8. if appvserison == "" {
  9. appvserison = c.GetHeader("app_version_name")
  10. }
  11. if appvserison != "" {
  12. c.Request.Header.Add("app_version_name", appvserison)
  13. }
  14. c.Next()
  15. }