mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-27 03:23:50 +00:00
created test for body_or_str and made small improvement to scrapy.http.response
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40602
This commit is contained in:
parent
808923f5fd
commit
d706182e97
@ -29,10 +29,11 @@ class Response(object) :
|
||||
self.original_url = Url(original_url) if original_url else url # different if redirected or escaped
|
||||
self.headers = Headers(headers or {})
|
||||
self.status = status
|
||||
if isinstance(body, str):
|
||||
self.body = ResponseBody(body, self.headers_encoding())
|
||||
else:
|
||||
# FIXME this should be replaced with assert(isinstance(body, basestring)) since ResponseBody is not meant to be used directly
|
||||
if isinstance(body, ResponseBody):
|
||||
self.body = body
|
||||
else:
|
||||
self.body = ResponseBody(body, self.headers_encoding())
|
||||
self.cached = False
|
||||
self.request = None # request which originated this response
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user