gin_resp_logger.go 263 B

12345678910111213141516
  1. package http_middleware
  2. import (
  3. "github.com/gin-gonic/gin"
  4. )
  5. const IsLogHTTPResponse = "isLogHttpResponse"
  6. // 记录http响应结果
  7. func RespLogger() gin.HandlerFunc {
  8. return func(ctxt *gin.Context) {
  9. ctxt.Set(IsLogHTTPResponse, true)
  10. ctxt.Next()
  11. }
  12. }