mirror of
https://github.com/httpie/cli.git
synced 2024-11-07 16:34:35 +01:00
Fixed Content-Type retrieval for Python 3.
This commit is contained in:
parent
72cf7c2cb7
commit
289e9b844e
@ -116,6 +116,9 @@ def filename_from_url(url, content_type):
|
||||
else:
|
||||
ext = mimetypes.guess_extension(content_type)
|
||||
|
||||
if ext == '.htm': # Python 3
|
||||
ext = '.html'
|
||||
|
||||
if ext:
|
||||
fn += ext
|
||||
|
||||
|
@ -87,7 +87,13 @@ class HTTPMessage(object):
|
||||
@property
|
||||
def content_type(self):
|
||||
"""Return the message content type."""
|
||||
ct = self._orig.headers.get('Content-Type', '')
|
||||
ct = self._orig.headers.get(
|
||||
b'Content-Type',
|
||||
self._orig.headers.get(
|
||||
'Content-Type',
|
||||
''
|
||||
)
|
||||
)
|
||||
if isinstance(ct, bytes):
|
||||
ct = ct.decode()
|
||||
return ct
|
||||
|
Loading…
Reference in New Issue
Block a user