tsweb: add String method to tsweb.RequestID
In case we want to change the format to something opaque later. Updates tailscale/corp#2549 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: Ie2eac8b885b694be607e9d5101d24b650026d89c
This commit is contained in:
parent
90c4067010
commit
8f27d519bb
|
@ -25,6 +25,12 @@ import (
|
||||||
// opaque string. The current implementation uses a UUID.
|
// opaque string. The current implementation uses a UUID.
|
||||||
type RequestID string
|
type RequestID string
|
||||||
|
|
||||||
|
// String returns the string format of the request ID, for use in e.g. setting
|
||||||
|
// a [http.Header].
|
||||||
|
func (r RequestID) String() string {
|
||||||
|
return string(r)
|
||||||
|
}
|
||||||
|
|
||||||
// RequestIDKey stores and loads [RequestID] values within a [context.Context].
|
// RequestIDKey stores and loads [RequestID] values within a [context.Context].
|
||||||
var RequestIDKey ctxkey.Key[RequestID]
|
var RequestIDKey ctxkey.Key[RequestID]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue