diff --git a/sdk/internal/recording/recording.go b/sdk/internal/recording/recording.go index df82a14b8cb5..22dc78f6a5de 100644 --- a/sdk/internal/recording/recording.go +++ b/sdk/internal/recording/recording.go @@ -537,10 +537,10 @@ func defaultOptions() *RecordingOptions { } } -func (r RecordingOptions) ReplaceAuthority(t *testing.T, rawReq *http.Request) (*http.Request, string, string) { - originalURLScheme := rawReq.URL.Scheme - originalURLHost := rawReq.URL.Host +func (r RecordingOptions) ReplaceAuthority(t *testing.T, rawReq *http.Request) *http.Request { if GetRecordMode() != LiveMode && !IsLiveOnly(t) { + originalURLHost := rawReq.URL.Host + // don't modify the original request cp := *rawReq cpURL := *cp.URL @@ -556,7 +556,7 @@ func (r RecordingOptions) ReplaceAuthority(t *testing.T, rawReq *http.Request) ( cp.Header.Set(IDHeader, GetRecordingId(t)) rawReq = &cp } - return rawReq, originalURLScheme, originalURLHost + return rawReq } func (r RecordingOptions) host() string { @@ -941,7 +941,9 @@ type RecordingHTTPClient struct { } func (c RecordingHTTPClient) Do(req *http.Request) (*http.Response, error) { - req, origScheme, origHost := c.options.ReplaceAuthority(c.t, req) + origScheme := req.URL.Scheme + origHost := req.URL.Host + req = c.options.ReplaceAuthority(c.t, req) resp, err := c.defaultClient.Do(req) if err != nil { return nil, err diff --git a/sdk/internal/recording/testdata/recordings/TestRecording/TestGenerateAlphaNumericID.json b/sdk/internal/recording/testdata/recordings/TestRecording/TestGenerateAlphaNumericID.json index f7f287bc1d2d..6c9ca58c3a2d 100644 --- a/sdk/internal/recording/testdata/recordings/TestRecording/TestGenerateAlphaNumericID.json +++ b/sdk/internal/recording/testdata/recordings/TestRecording/TestGenerateAlphaNumericID.json @@ -1,6 +1,6 @@ { "Entries": [], "Variables": { - "randSeed": "1701821574" + "randSeed": "1701896129" } }