From 4c207e8ca75308fc9bcca4b6d7ea3bcf84a40d72 Mon Sep 17 00:00:00 2001 From: Jesse Peterson Date: Wed, 13 Mar 2024 11:05:55 -0700 Subject: [PATCH] copy User-Agent from DEP request to auth/session request (#45) --- 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) }