MCPcopy Create free account
hub / github.com/LumaAI-API/Luma-API / RequestId

Function RequestId

middleware/request-id.go:11–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9const RequestIdKey = "X-Any2api-Request-Id"
10
11func RequestId() func(c *gin.Context) {
12 return func(c *gin.Context) {
13 id := common.GetTimeString() + common.GetRandomString(8)
14 c.Set(RequestIdKey, id)
15 ctx := context.WithValue(c.Request.Context(), RequestIdKey, id)
16 c.Request = c.Request.WithContext(ctx)
17 c.Header(RequestIdKey, id)
18 c.Next()
19 }
20}

Callers 1

mainFunction · 0.92

Calls 2

GetTimeStringFunction · 0.92
GetRandomStringFunction · 0.92

Tested by

no test coverage detected