Skip to content

Commit 4064fcf

Browse files
author
Michael Stella
committed
switch setter for injecting headers w/propagator
Occasionally not all of the headers available to botocore are strings. It does allow this, using the `add_header` method rather than `__setitem__`. According to the docs for `botocore.compat.HTTPHeaders`: ``` If a parameter value contains non-ASCII characters it can be specified as a three-tuple of (charset, language, value), in which case it will be encoded according to RFC2231 rules. Otherwise it will be encoded using the utf-8 charset and a language of '' ``` Whereas using `__setitem__` does not do this conversion. Fixes open-telemetry#262
1 parent 65801c3 commit 4064fcf

File tree

1 file changed

+1
-1
lines changed
  • instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore

1 file changed

+1
-1
lines changed

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
def _patched_endpoint_prepare_request(wrapped, instance, args, kwargs):
6868
request = args[0]
6969
headers = request.headers
70-
propagators.inject(type(headers).__setitem__, headers)
70+
propagators.inject(type(headers).add_header, headers)
7171
return wrapped(*args, **kwargs)
7272

7373

0 commit comments

Comments
 (0)