1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Fixed Content-Type retrieval for Python 3.

This commit is contained in:
Jakub Roztocil
2013-04-12 14:01:24 -03:00
parent 72cf7c2cb7
commit 289e9b844e
2 changed files with 10 additions and 1 deletions

View File

@@ -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