Compare commits

...

12 Commits
0.2.3 ... 0.2.5

Author SHA1 Message Date
1ce02ebbd5 0.2.5 (bugfixes) 2012-07-17 01:39:02 +02:00
8a7f4c0d6e Fixed tests exist status. 2012-07-17 01:33:18 +02:00
f29c458611 Python 3 fixes. 2012-07-17 01:26:21 +02:00
2d7df0afb4 Fixed AttributeError in Content-Type vendor removal. 2012-07-17 01:11:43 +02:00
16a7d0a719 Fixed accidentally remove __licence__. 2012-07-17 01:11:01 +02:00
0cffda86f6 0.2.5dev 2012-07-17 00:47:42 +02:00
f42ee6da85 0.2.5dev 2012-07-17 00:45:20 +02:00
deeb7cbbac 0.2.4 (bad upload of 0.2.3 to pypi). 2012-07-17 00:44:25 +02:00
12f2fb4a92 Merge branch 'master' of github.com:jkbr/httpie 2012-07-17 00:38:41 +02:00
489bd64295 0.2.4dev 2012-07-17 00:37:53 +02:00
2036337a53 Merge pull request #69 from jokull/master
Prettify vendor+json and vendor+xml Content-Type responses
2012-07-16 15:27:50 -07:00
36de166b28 Simplify vendor extension content-types since they are most likely lexable 2012-07-14 14:27:11 +00:00
5 changed files with 24 additions and 9 deletions

View File

@ -225,7 +225,7 @@ Before a pull requests is submitted, it's a good idea to run the existing suite
Changelog
---------
* `0.2.3 <https://github.com/jkbr/httpie/compare/0.2.2...0.2.3>`_ (2012-06-24)
* `0.2.5 <https://github.com/jkbr/httpie/compare/0.2.2...0.2.5>`_ (2012-07-17)
* Unicode characters in prettified JSON now don't get escaped to improve readability.
* --auth now prompts for a password if only a username provided.
* Added support for request payloads from a file path with automatic ``Content-Type`` (``http URL @/path``).

View File

@ -3,5 +3,5 @@ HTTPie - cURL for humans.
"""
__author__ = 'Jakub Roztocil'
__version__ = '0.2.3'
__version__ = '0.2.5'
__licence__ = 'BSD'

View File

@ -1,4 +1,5 @@
import os
import re
import json
import pygments
@ -18,6 +19,8 @@ FORMATTER = (Terminal256Formatter
if '256color' in os.environ.get('TERM', '')
else TerminalFormatter)
application_content_type_re = re.compile(r'application/(.+\+)(json|xml)$')
class PrettyHttp(object):
@ -33,12 +36,18 @@ class PrettyHttp(object):
def body(self, content, content_type):
content_type = content_type.split(';')[0]
application_match = re.match(application_content_type_re, content_type)
if application_match:
# Strip vendor and extensions from Content-Type
vendor, extension = application_match.groups()
content_type = content_type.replace(vendor, '')
try:
lexer = get_lexer_for_mimetype(content_type)
except ClassNotFound:
return content
if content_type == 'application/json':
if content_type == "application/json":
try:
# Indent and sort the JSON data.
content = json.dumps(json.loads(content),

View File

@ -5,7 +5,8 @@ import httpie
if sys.argv[-1] == 'test':
sys.exit(os.system('python tests/tests.py'))
status = os.system('python tests/tests.py')
sys.exit(1 if status > 127 else status)
requirements = [

View File

@ -5,7 +5,7 @@ import os
import sys
import tempfile
import json
from requests.compat import is_py26
from requests.compat import is_py26, is_py3
from requests import Response
@ -453,7 +453,7 @@ class FakeResponse(Response):
return self
def __repr__(self):
return u'Mock string'
return 'Mock string'
def __unicode__(self):
return self.__repr__()
@ -470,8 +470,13 @@ class UnicodeOutputTestCase(BaseTestCase):
def test_unicode_output(self):
# some cyrillic and simplified chinese symbols
response_dict = {u'Привет': u'Мир!',
u'Hello': u'世界'}
response_dict = {'Привет': 'Мир!',
'Hello': '世界'}
if not is_py3:
response_dict = dict(
(k.decode('utf8'), v.decode('utf8'))
for k, v in response_dict.items()
)
response_body = json.dumps(response_dict)
# emulate response
response = FakeResponse(response_body)
@ -486,7 +491,7 @@ class UnicodeOutputTestCase(BaseTestCase):
# colorized output contains escape sequences
output = __main__._get_output(args, True, response)
for key, value in response_dict.iteritems():
for key, value in response_dict.items():
self.assertIn(key, output)
self.assertIn(value, output)