广告平台(站长使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mw_change_header.go 338 B

4 months ago
1234567891011121314151617
  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. }