Skip to content

Don't create duplicate headers#2727

Merged
iNikem merged 18 commits into
open-telemetry:mainfrom
trask:duplicate-headers
Apr 12, 2021
Merged

Don't create duplicate headers#2727
iNikem merged 18 commits into
open-telemetry:mainfrom
trask:duplicate-headers

Conversation

@trask

@trask trask commented Apr 6, 2021

Copy link
Copy Markdown
Member

Resolves #2594

Adds a new test to HttpClientTest that create a request, sends the request, and then reuses that request (sending it a second time).

Most of the http client libraries support this kind of reuse, and several of our instrumentations would end up adding the traceparent header multiple times (#2594).

HttpTestServer now throws an exception if there is more than one traceparent header.

To implement the new test, the doRequest() method that was implemented in each subclass of HttpClientTest has been split into two methods:

  • buildRequest()
  • sendRequest()

The normal doRequest (now final) is implemented as buildRequest + sendRequest, while the new doReusedRequest (also final) is implemented as buildRequest + sendRequest + sendRequest.

@trask trask marked this pull request as ready for review April 9, 2021 02:52
@iNikem iNikem merged commit 3bc058b into open-telemetry:main Apr 12, 2021
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.

HttpHeadersInjectAdapter should use 'setHeader' instead of 'addHeader'?

4 participants