Skip to content

Commit

Permalink
fix dict key failed in requests (#713)
Browse files Browse the repository at this point in the history
> add testcase for **parameters
  • Loading branch information
eeliu authored Jan 2, 2025
1 parent 0710996 commit 0a33d1d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/PY/pinpointPy/libs/_requests/NextSpanPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def isSample(*args, **kwargs):

def onBefore(self, parentId, *args, **kwargs):
traceId, _args, _kwargs = super().onBefore(parentId, *args, **kwargs)
url = _args[1]
url = kwargs.get('url') or args[1]
target = urlparse(url).netloc
###############################################################
pinpoint.add_trace_header(
Expand Down
10 changes: 10 additions & 0 deletions plugins/PY/pinpointPy/libs/_requests/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ def test_request(self):
httpbin = create_http_bin_response(body.text)
self.assertIn(Defines.PP_HEADER_PINPOINT_SPANID, httpbin.headers)

@PinTransaction("testcase", GenTestHeader())
def test_request_kwargs(self):
import requests
parameters = {
'method': "POST", "url": 'http://httpbin/anything', "data": 'abc'
}
body = requests.request(**parameters)
httpbin = create_http_bin_response(body.text)
self.assertIn(Defines.PP_HEADER_PINPOINT_SPANID, httpbin.headers)

def test_request_no_transaction(self):
import requests
from threading import Thread
Expand Down

0 comments on commit 0a33d1d

Please sign in to comment.