Ensure clean http url (#538)

This commit is contained in:
Ryo Kather
2021-06-11 09:01:52 -07:00
committed by GitHub
parent e347fa7541
commit 865837f757
21 changed files with 155 additions and 9 deletions

View File

@ -364,6 +364,18 @@ class TestWsgiAttributes(unittest.TestCase):
self.assertEqual(self.span.set_attribute.call_count, len(expected))
self.span.set_attribute.assert_has_calls(expected, any_order=True)
def test_credential_removal(self):
self.environ["HTTP_HOST"] = "username:password@httpbin.com"
self.environ["PATH_INFO"] = "/status/200"
expected = {
SpanAttributes.HTTP_URL: "http://httpbin.com/status/200",
SpanAttributes.NET_HOST_PORT: 80,
}
self.assertGreaterEqual(
otel_wsgi.collect_request_attributes(self.environ).items(),
expected.items(),
)
class TestWsgiMiddlewareWithTracerProvider(WsgiTestBase):
def validate_response(