Skip to content

Commit

Permalink
Merge branch 'master' into feature/trace-get-current-span
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed Jun 9, 2020
2 parents 3d30915 + 93194e1 commit 412d20f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ def instrumented_request(self, method, url, *args, **kwargs):
span.set_attribute("http.method", method.upper())
span.set_attribute("http.url", url)

headers = kwargs.setdefault("headers", {})
headers = kwargs.get("headers", {}) or {}
propagators.inject(type(headers).__setitem__, headers)
kwargs["headers"] = headers

try:
result = wrapped(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ def test_custom_tracer_provider(self):

self.assertIs(span.resource, resource)

def test_if_headers_equals_none(self):
result = requests.get(self.URL, headers=None)
self.assertEqual(result.text, "Hello!")

@mock.patch("requests.Session.send", side_effect=requests.RequestException)
def test_requests_exception_without_response(self, *_, **__):

Expand Down

0 comments on commit 412d20f

Please sign in to comment.