mirror of
https://github.com/httpie/cli.git
synced 2024-11-25 09:13:25 +01:00
Corrected line breaks in the output.
This commit is contained in:
parent
bd9209f77a
commit
ebb271334b
@ -100,13 +100,15 @@ def main(args=None,
|
|||||||
body = prettify.body(body, response.headers['Content-Type'])
|
body = prettify.body(body, response.headers['Content-Type'])
|
||||||
|
|
||||||
# Output.
|
# Output.
|
||||||
|
# TODO: preserve leading/trailing whitespaces in the body.
|
||||||
|
# Some of the Pygments styles add superfluous line breaks.
|
||||||
if args.print_headers:
|
if args.print_headers:
|
||||||
stdout.write(status_line)
|
stdout.write(status_line.strip())
|
||||||
stdout.write('\n')
|
stdout.write('\n')
|
||||||
stdout.write(headers.encode('utf-8'))
|
stdout.write(headers.strip().encode('utf-8'))
|
||||||
stdout.write('\n\n')
|
stdout.write('\n\n')
|
||||||
if args.print_body:
|
if args.print_body:
|
||||||
stdout.write(body.encode('utf-8'))
|
stdout.write(body.strip().encode('utf-8'))
|
||||||
stdout.write('\n')
|
stdout.write('\n')
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class PrettyHttp(object):
|
|||||||
self.formatter = FORMATTER(style=style)
|
self.formatter = FORMATTER(style=style)
|
||||||
|
|
||||||
def headers(self, content):
|
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):
|
def body(self, content, content_type):
|
||||||
content_type = content_type.split(';')[0]
|
content_type = content_type.split(';')[0]
|
||||||
@ -59,6 +59,4 @@ class PrettyHttp(object):
|
|||||||
except ClassNotFound:
|
except ClassNotFound:
|
||||||
return content
|
return content
|
||||||
content = pygments.highlight(content, lexer, self.formatter)
|
content = pygments.highlight(content, lexer, self.formatter)
|
||||||
# TODO: Make sure the leading/trailing whitespaces remain.
|
return content
|
||||||
# Some of the Pygments styles add superfluous line breaks.
|
|
||||||
return content.strip()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user