Skip to content

Commit

Permalink
switch setter for injecting headers w/propagator
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Michael Stella committed Dec 18, 2020
1 parent 65801c3 commit 4064fcf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
def _patched_endpoint_prepare_request(wrapped, instance, args, kwargs):
request = args[0]
headers = request.headers
propagators.inject(type(headers).__setitem__, headers)
propagators.inject(type(headers).add_header, headers)
return wrapped(*args, **kwargs)


Expand Down

0 comments on commit 4064fcf

Please sign in to comment.