Skip to content

Copy metadata header values into each request - #185

Open
bensynapse wants to merge 1 commit into
monzo:masterfrom
bensynapse:fix-request-metadata-headers
Open

bensynapse wants to merge 1 commit into
monzo:masterfrom
bensynapse:fix-request-metadata-headers

Conversation

@bensynapse

Copy link
Copy Markdown

I run Live Tennis API.

NewRequest now copies metadata header values. Editing one request no longer changes its context metadata or another request.

The old assignment shared slice storage across requests. Concurrent edits to separate requests could race. Lowercase header names and nil or empty values keep their existing behavior.

I added tests for request isolation, context isolation and concurrent edits to separate requests. An HTTP test checks the headers received by a local server.

The project checks pass on Go 1.24.0 and 1.25.0 in Docker.
I ran go vet ./..., go test -v ./..., go test -race ./... and go build ./....
All 188 tests and subtests pass. The six new cases also pass 50 race runs.
Four regression cases fail before the fix, including the HTTP test and a data race.
The optional golint step reports seven findings in untouched files.

The first Go 1.25 race run reported a premature response, then timed out in TestE2EDraining.
Fresh full race runs passed on this branch and untouched upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant