# XXX support proxies
- async def _request(self, method, path, body_producer=None, **kwargs):
+ async def _request(self, method, path, body=None, body_producer=None, **kwargs):
# Make absolute URL
url = urllib.parse.urljoin(self.url, path)
+ # Convert any query arguments
+ query_args = urllib.parse.urlencode(kwargs)
+
# Add query arguments
if method in ("GET", "PUT"):
- url = "%s?%s" % (url, urllib.parse.urlencode(kwargs))
+ url = "%s?%s" % (url, query_args)
+
+ # Add any arguments to the body
+ elif method == "POST":
+ if body is None:
+ body = query_args
# Make the request
req = tornado.httpclient.HTTPRequest(
- method=method, url=url,
+ method=method, url=url, body=body,
# Authentication
auth_username=self.username, auth_password=self.password,