Skip to content

Commit

Permalink
fix(httpreplay): ignore GCS header by default (#8260)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tritone committed Jul 13, 2023
1 parent 22a908b commit b961a1a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions httpreplay/cmd/httpr/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ func start(modeFlag, filename string) (*exec.Cmd, *http.Transport, string, error
modeFlag,
filename,
"-debug-headers",
"-ignore-header", "X-Goog-Api-Client",
"-ignore-header", "X-Goog-Gcs-Idempotency-Token",
)
if err := cmd.Start(); err != nil {
return nil, nil, "", err
Expand Down
4 changes: 0 additions & 4 deletions httpreplay/httpreplay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ func TestIntegration_RecordAndReplay(t *testing.T) {
if err != nil {
t.Fatal(err)
}
rec.RemoveRequestHeaders("X-Goog-Api-Client")
rec.RemoveRequestHeaders("X-Goog-Gcs-Idempotency-Token")

hc, err := rec.Client(ctx, option.WithTokenSource(
testutil.TokenSource(ctx, storage.ScopeFullControl)))
Expand All @@ -86,8 +84,6 @@ func TestIntegration_RecordAndReplay(t *testing.T) {
if err != nil {
t.Fatal(err)
}
rep.IgnoreHeader("X-Goog-Api-Client")
rep.IgnoreHeader("X-Goog-Gcs-Idempotency-Token")
defer rep.Close()
hc, err = rep.Client(ctx)
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions httpreplay/internal/proxy/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ var (
"Via",
"X-Forwarded-*",
// Google-specific
"X-Cloud-Trace-Context", // OpenCensus traces have a random ID
"X-Goog-Api-Client", // can differ for, e.g., different Go versions
"X-Cloud-Trace-Context", // OpenCensus traces have a random ID
"X-Goog-Api-Client", // can differ for, e.g., different Go versions
"X-Goog-Gcs-Idempotency-Token", // Used by Cloud Storage
}

defaultRemoveBothHeaders = []string{
Expand Down

0 comments on commit b961a1a

Please sign in to comment.