-
Notifications
You must be signed in to change notification settings - Fork 201
Closed
Labels
Milestone
Description
When the Response was created from stream, the _status_code__get() method cannot detect status code properly, becourse it tries to sptlit start line and convert first element to int (HTTP/1.1 in my case).
resp = """HTTP/1.1 200 OK
Cache-Control: private, no-store,No-Store
Content-Length: 1024
Content-Type: application/octet-stream
ETag: ""
Server: Microsoft-IIS/7.5
content-disposition: attachment; filename=1kb.txt
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Thu, 19 Sep 2013 13:57:07 GMT
Some data...
"""
s = StringIO()
s.write(resp)
s.seek(0)
r = Response.from_file(s)
print r.status_code
Traceback (most recent call last):
File "<string>", line 254, in run_nodebug
File "...", line 45, in <module>
print r.status_code
File "C:\Python27\lib\site-packages\webob\response.py", line 272, in _status_code__get
return int(self._status.split()[0])
ValueError: invalid literal for int() with base 10: 'HTTP/1.1'