Skip to content

Commit b961a1a

Browse files
authored
fix(httpreplay): ignore GCS header by default (#8260)
New GCS header x-goog-gcs-idempotency-token should be on the list to be ignored by default. Also change the integration test so that the test isn't explicitly requesting that it be ignored. Fixes #8233
1 parent 22a908b commit b961a1a

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

httpreplay/cmd/httpr/integration_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ func start(modeFlag, filename string) (*exec.Cmd, *http.Transport, string, error
149149
modeFlag,
150150
filename,
151151
"-debug-headers",
152-
"-ignore-header", "X-Goog-Api-Client",
153-
"-ignore-header", "X-Goog-Gcs-Idempotency-Token",
154152
)
155153
if err := cmd.Start(); err != nil {
156154
return nil, nil, "", err

httpreplay/httpreplay_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ func TestIntegration_RecordAndReplay(t *testing.T) {
6767
if err != nil {
6868
t.Fatal(err)
6969
}
70-
rec.RemoveRequestHeaders("X-Goog-Api-Client")
71-
rec.RemoveRequestHeaders("X-Goog-Gcs-Idempotency-Token")
7270

7371
hc, err := rec.Client(ctx, option.WithTokenSource(
7472
testutil.TokenSource(ctx, storage.ScopeFullControl)))
@@ -86,8 +84,6 @@ func TestIntegration_RecordAndReplay(t *testing.T) {
8684
if err != nil {
8785
t.Fatal(err)
8886
}
89-
rep.IgnoreHeader("X-Goog-Api-Client")
90-
rep.IgnoreHeader("X-Goog-Gcs-Idempotency-Token")
9187
defer rep.Close()
9288
hc, err = rep.Client(ctx)
9389
if err != nil {

httpreplay/internal/proxy/converter.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ var (
7979
"Via",
8080
"X-Forwarded-*",
8181
// Google-specific
82-
"X-Cloud-Trace-Context", // OpenCensus traces have a random ID
83-
"X-Goog-Api-Client", // can differ for, e.g., different Go versions
82+
"X-Cloud-Trace-Context", // OpenCensus traces have a random ID
83+
"X-Goog-Api-Client", // can differ for, e.g., different Go versions
84+
"X-Goog-Gcs-Idempotency-Token", // Used by Cloud Storage
8485
}
8586

8687
defaultRemoveBothHeaders = []string{

0 commit comments

Comments
 (0)