Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete pre-existing HTTP Header keys to avoid append #40

Merged
merged 3 commits into from
Sep 25, 2017

Conversation

pglombardo
Copy link
Contributor

@pglombardo pglombardo commented Sep 24, 2017

If you re-use the net/http request object and pass request.Header to the tracer.Inject function multiple times, values will actually get appended to already set headers.

This is because the TextMapWriter interface in Go OpenTracing calls only http.Header.Add() (as seen here) and the end implementation of Add() in http.Header states It appends to any existing values associated with key.

This PR checks for and deletes any pre-existing keys on Inject.

Thanks @vetinari for the heads up and a test to demonstrate.

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