@@ -305,6 +305,30 @@ def test_ext_service(int_config, pin, config_val, default, expected):
305305 (None , None , None , None , None , None ),
306306 ("GET" , "http://localhost/" , 200 , "OK" , None , {"my-header" : "value1" }),
307307 ("GET" , "http://localhost/" , 200 , "OK" , "search?q=test+query" , {"my-header" : "value1" }),
308+ (
309+ "GET" ,
310+ "http://user:pass@localhost/" ,
311+ 0 ,
312+ None ,
313+ None ,
314+ None ,
315+ ),
316+ (
317+ "GET" ,
318+ "http://user@localhost/" ,
319+ 0 ,
320+ None ,
321+ None ,
322+ None ,
323+ ),
324+ (
325+ "GET" ,
326+ "http://user:pass@localhost/api?q=test" ,
327+ 0 ,
328+ None ,
329+ None ,
330+ None ,
331+ ),
308332 ],
309333)
310334def test_set_http_meta (span , int_config , method , url , status_code , status_msg , query , request_headers ):
@@ -326,7 +350,13 @@ def test_set_http_meta(span, int_config, method, url, status_code, status_msg, q
326350 assert http .METHOD not in span .get_tags ()
327351
328352 if url is not None :
329- assert span .get_tag (http .URL ) == stringify (url )
353+ if url .startswith ("http://user" ):
354+ # Remove any userinfo that may be in the original url
355+ expected_url = url [: url .index (":" )] + "://" + url [url .index ("@" ) + 1 :]
356+ else :
357+ expected_url = url
358+
359+ assert span .get_tag (http .URL ) == stringify (expected_url )
330360 else :
331361 assert http .URL not in span .get_tags ()
332362
0 commit comments