diff options
Diffstat (limited to 'weed/util/request_id.go')
| -rw-r--r-- | weed/util/request_id.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/weed/util/request_id.go b/weed/util/request_id.go deleted file mode 100644 index 7945e7cc4..000000000 --- a/weed/util/request_id.go +++ /dev/null @@ -1,27 +0,0 @@ -package util - -import ( - "context" - "net/http" -) - -const ( - RequestIdHttpHeader = "X-Request-ID" - RequestIDKey = "x-request-id" -) - -func GetRequestID(ctx context.Context) string { - if ctx == nil { - return "" - } - id, _ := ctx.Value(RequestIDKey).(string) - return id -} - -func WithRequestID(ctx context.Context, id string) context.Context { - return context.WithValue(ctx, RequestIDKey, id) -} - -func ReqWithRequestId(req *http.Request, ctx context.Context) { - req.Header.Set(RequestIdHttpHeader, GetRequestID(ctx)) -} |
