1
0
mirror of https://github.com/httpie/cli.git synced 2024-11-28 08:38:44 +02:00

Corrected line breaks in the output.

This commit is contained in:
Jakub Roztočil 2012-03-04 13:03:21 +01:00
parent bd9209f77a
commit ebb271334b
2 changed files with 7 additions and 7 deletions

View File

@ -100,13 +100,15 @@ def main(args=None,
body = prettify.body(body, response.headers['Content-Type'])
# Output.
# TODO: preserve leading/trailing whitespaces in the body.
# Some of the Pygments styles add superfluous line breaks.
if args.print_headers:
stdout.write(status_line)
stdout.write(status_line.strip())
stdout.write('\n')
stdout.write(headers.encode('utf-8'))
stdout.write(headers.strip().encode('utf-8'))
stdout.write('\n\n')
if args.print_body:
stdout.write(body.encode('utf-8'))
stdout.write(body.strip().encode('utf-8'))
stdout.write('\n')

View File

@ -42,7 +42,7 @@ class PrettyHttp(object):
self.formatter = FORMATTER(style=style)
def headers(self, content):
return pygments.highlight(content, HTTPLexer(), self.formatter).strip()
return pygments.highlight(content, HTTPLexer(), self.formatter)
def body(self, content, content_type):
content_type = content_type.split(';')[0]
@ -59,6 +59,4 @@ class PrettyHttp(object):
except ClassNotFound:
return content
content = pygments.highlight(content, lexer, self.formatter)
# TODO: Make sure the leading/trailing whitespaces remain.
# Some of the Pygments styles add superfluous line breaks.
return content.strip()
return content