update README and enhance request ID handling

This commit is contained in:
2024-11-23 12:39:12 +01:00
parent 2340bdca11
commit 5183e62271
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -53,6 +53,7 @@ type (
)
const (
RequestID string = "request_id"
HeaderJSON string = "application/json"
HeaderHTML_UTF8 string = "text/html; charset=utf-8"
HeaderCSS_UTF8 string = "text/css; charset=utf-8"
@@ -166,7 +167,7 @@ func (e *Engine) requestIdMiddleware() Middleware {
if id == "" {
id = fmt.Sprintf("%d", time.Now().UnixNano())
}
ctx = context.WithValue(ctx, "requestId", id)
ctx = context.WithValue(ctx, RequestID, id)
next.ServeHTTP(w, r.WithContext(ctx))
})
}