Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGa98dabdb5a7b: py3: convert URL to str before passing it to request
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
if curlcmd: | if curlcmd: | ||||
sin, sout = procutil.popen2(b'%s -d @- %s' | sin, sout = procutil.popen2(b'%s -d @- %s' | ||||
% (curlcmd, procutil.shellquote(url))) | % (curlcmd, procutil.shellquote(url))) | ||||
sin.write(data) | sin.write(data) | ||||
sin.close() | sin.close() | ||||
body = sout.read() | body = sout.read() | ||||
else: | else: | ||||
urlopener = urlmod.opener(repo.ui, authinfo) | urlopener = urlmod.opener(repo.ui, authinfo) | ||||
request = util.urlreq.request(url, data=data) | request = util.urlreq.request(pycompat.strurl(url), data=data) | ||||
with contextlib.closing(urlopener.open(request)) as rsp: | with contextlib.closing(urlopener.open(request)) as rsp: | ||||
body = rsp.read() | body = rsp.read() | ||||
repo.ui.debug(b'Conduit Response: %s\n' % body) | repo.ui.debug(b'Conduit Response: %s\n' % body) | ||||
parsed = pycompat.rapply( | parsed = pycompat.rapply( | ||||
lambda x: encoding.unitolocal(x) if isinstance(x, pycompat.unicode) | lambda x: encoding.unitolocal(x) if isinstance(x, pycompat.unicode) | ||||
else x, | else x, | ||||
json.loads(body) | json.loads(body) | ||||
) | ) |