From 3287c9aa848343000d5f1dc90ca0c49421e370f4 Mon Sep 17 00:00:00 2001 From: Jesse Peterson Date: Thu, 22 Feb 2024 22:03:02 -0800 Subject: [PATCH] copy User-Agent from DEP request to auth/session request --- client/transport.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/transport.go b/client/transport.go index 22c26fb..bd38190 100644 --- a/client/transport.go +++ b/client/transport.go @@ -221,6 +221,10 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { sessionURL.String(), nil, ) + if userAgent := req.Header.Get("User-Agent"); userAgent != "" { + // copy the UA from the original request to the auth request + sessionReq.Header.Set("User-Agent", userAgent) + } if err != nil { return nil, fmt.Errorf("transport: creating session request: %w", err) }