Skip to content

Commit 10d2bbf

Browse files
committed
Added request id
Signed-off-by: Vishal Rana <[email protected]>
1 parent 1630ae8 commit 10d2bbf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

util.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"net"
55
"net/http"
66
"strings"
7+
8+
"github.com/labstack/gommon/random"
79
)
810

911
const (
@@ -17,6 +19,9 @@ func RequestID(r *http.Request, w http.ResponseWriter) string {
1719
if id == "" {
1820
id = w.Header().Get("X-Request-ID")
1921
}
22+
if id == "" {
23+
return random.String(32)
24+
}
2025
return id
2126
}
2227

0 commit comments

Comments
 (0)