Skip to content

Commit

Permalink
Refactor 4bc279b (#22111)
Browse files Browse the repository at this point in the history
Make the fix in a non-breaking way.
  • Loading branch information
jhendrixMSFT authored Dec 6, 2023
1 parent 12830d0 commit 0270c00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions sdk/internal/recording/recording.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Entries": [],
"Variables": {
"randSeed": "1701821574"
"randSeed": "1701896129"
}
}

0 comments on commit 0270c00

Please sign in to comment.