1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-17 01:43:02 +02:00

Enable custom request id generator (#881)

This commit is contained in:
nownabe
2017-03-18 01:22:58 +09:00
committed by Vishal Rana
parent b2430fc4a8
commit cb6f0a5f80
2 changed files with 14 additions and 4 deletions

View File

@ -50,7 +50,7 @@ func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc {
res := c.Response()
rid := req.Header.Get(echo.HeaderXRequestID)
if rid == "" {
rid = random.String(32)
rid = config.Generator()
}
res.Header().Set(echo.HeaderXRequestID, rid)