mirror of
https://github.com/httpie/cli.git
synced 2025-02-03 03:09:17 +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:
|
else:
|
||||||
ext = mimetypes.guess_extension(content_type)
|
ext = mimetypes.guess_extension(content_type)
|
||||||
|
|
||||||
|
if ext == '.htm': # Python 3
|
||||||
|
ext = '.html'
|
||||||
|
|
||||||
if ext:
|
if ext:
|
||||||
fn += ext
|
fn += ext
|
||||||
|
|
||||||
|
@ -87,7 +87,13 @@ class HTTPMessage(object):
|
|||||||
@property
|
@property
|
||||||
def content_type(self):
|
def content_type(self):
|
||||||
"""Return the message content type."""
|
"""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):
|
if isinstance(ct, bytes):
|
||||||
ct = ct.decode()
|
ct = ct.decode()
|
||||||
return ct
|
return ct
|
||||||
|
Loading…
Reference in New Issue
Block a user