]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
raise ValueError if supply both a request object and **kwargs 1604/head
authorliaoxiaorong <xiaorongliao@gmail.com>
Tue, 22 Dec 2015 04:18:38 +0000 (12:18 +0800)
committerliaoxiaorong <xiaorongliao@gmail.com>
Tue, 22 Dec 2015 04:18:38 +0000 (12:18 +0800)
tornado/httpclient.py

index 394c7fb1c504829dc53ca9223e1ebbe1f5a92a36..90c78119b7ca2af7c98fbb7af9a3c711857cee19 100644 (file)
@@ -228,12 +228,8 @@ class AsyncHTTPClient(Configurable):
         if not isinstance(request, HTTPRequest):
             request = HTTPRequest(url=request, **kwargs)
         else:
-            for k, v in kwargs.items():
-                try:
-                    getattr(request, k)
-                except Exception as e:
-                    raise ValueError('HTTPRequest get an unexcept kwags %s' % k)
-                setattr(request, k, v)
+            if kwargs:
+                raise ValueError("kwargs can't be used if request is an HTTPRequest object")
         # We may modify this (to add Host, Accept-Encoding, etc),
         # so make sure we don't modify the caller's object.  This is also
         # where normal dicts get converted to HTTPHeaders objects.