@@ -388,8 +388,12 @@ def put_json(self, *a, **k):
388
388
def _request (self , method , path = None , body = None , headers = None , ** params ):
389
389
all_headers = self .headers .copy ()
390
390
all_headers .update (headers or {})
391
- return self .session .request (method , urljoin (self .url , path , ** params ),
392
- body = body , headers = all_headers ,
391
+ if path is not None :
392
+ url = urljoin (self .url , path , ** params )
393
+ else :
394
+ url = urljoin (self .url , ** params )
395
+ return self .session .request (method , url , body = body ,
396
+ headers = all_headers ,
393
397
credentials = self .credentials )
394
398
395
399
@@ -461,13 +465,18 @@ def urljoin(base, *path, **query):
461
465
'http://example.org/foo%2Fbar'
462
466
>>> urljoin('http://example.org/', 'foo', '/bar/')
463
467
'http://example.org/foo/%2Fbar%2F'
468
+
469
+ >>> urljoin('http://example.org/', None)
470
+ Traceback (most recent call last):
471
+ ...
472
+ TypeError: argument 2 to map() must support iteration
464
473
"""
465
474
if base and base .endswith ('/' ):
466
475
base = base [:- 1 ]
467
476
retval = [base ]
468
477
469
478
# build the path
470
- path = '/' .join (['' ] + [quote (s ) for s in path if s is not None ])
479
+ path = '/' .join (['' ] + [quote (s ) for s in path ])
471
480
if path :
472
481
retval .append (path )
473
482
0 commit comments