Request ID middleware for Hertz framework, inspired by requestid. This project would not have been possible without the support from the CloudWeGo community and previous work done by the gin community.
- Adds an identifier to the response using the
X-Request-ID
header. - Passes the
X-Request-ID
value back to the caller if it's sent in the request headers.
go get github.com/hertz-contrib/requestid
usage | description |
---|---|
default | This is using requestid by default |
custom key | How to use requestid for custom key |
custom generator | How to use requestid for custom generator |
custom handler | How to use requestid for custom handler |
get requestid | How to get requestid |
log with hertzlogrus | How to log requestid with hertzlogrus |
This project is under the Apache License 2.0. See the LICENSE file for the full license text.