From 8f27d519bbcb55e2fac52c0d58e9f315ef9db79c Mon Sep 17 00:00:00 2001 From: Andrew Dunham Date: Wed, 6 Mar 2024 19:38:38 -0500 Subject: [PATCH] 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 Change-Id: Ie2eac8b885b694be607e9d5101d24b650026d89c --- tsweb/request_id.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tsweb/request_id.go b/tsweb/request_id.go index 19519f7a5..2db9cb767 100644 --- a/tsweb/request_id.go +++ b/tsweb/request_id.go @@ -25,6 +25,12 @@ import ( // opaque string. The current implementation uses a UUID. 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]. var RequestIDKey ctxkey.Key[RequestID]