mirror of https://github.com/scrapy/scrapy.git
make sure Request.method is always str
This commit is contained in:
parent
afa23688c6
commit
bac46ba438
|
|
@ -25,7 +25,7 @@ class Request(object_ref):
|
|||
dont_filter=False, errback=None):
|
||||
|
||||
self._encoding = encoding # this one has to be set first
|
||||
self.method = method.upper()
|
||||
self.method = str(method).upper()
|
||||
self._set_url(url)
|
||||
self._set_body(body)
|
||||
self.priority = priority
|
||||
|
|
|
|||
|
|
@ -162,6 +162,10 @@ class RequestTest(unittest.TestCase):
|
|||
self.assertEqual(r4.meta, {})
|
||||
assert r4.dont_filter is False
|
||||
|
||||
def test_method_always_str(self):
|
||||
r = self.request_class("http://www.example.com", method=u"POST")
|
||||
assert isinstance(r.method, str)
|
||||
|
||||
def test_weakref_slots(self):
|
||||
"""Check that classes are using slots and are weak-referenceable"""
|
||||
x = self.request_class('http://www.example.com')
|
||||
|
|
|
|||
Loading…
Reference in New Issue