From: liaoxiaorong Date: Tue, 22 Dec 2015 04:18:38 +0000 (+0800) Subject: raise ValueError if supply both a request object and **kwargs X-Git-Tag: v4.4.0b1~60^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c8a5f05bd9dded7a33cdc0ef3393c2ba8f9cf27;p=thirdparty%2Ftornado.git raise ValueError if supply both a request object and **kwargs --- diff --git a/tornado/httpclient.py b/tornado/httpclient.py index 394c7fb1c..90c78119b 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -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.