mirror of
https://github.com/httpie/cli.git
synced 2024-11-24 08:22:22 +02:00
Improved request formatting.
This commit is contained in:
parent
ccbea8c96e
commit
e2e749b2a6
@ -39,9 +39,9 @@ def format_http_message(message, prettifier=None,
|
||||
else:
|
||||
bits.append(message.line)
|
||||
bits.append(message.headers)
|
||||
if with_body:
|
||||
if with_body and message.body:
|
||||
bits.append('\n')
|
||||
if with_body:
|
||||
if with_body and message.body:
|
||||
if prettifier and message.content_type:
|
||||
bits.append(prettifier.body(message.body, message.content_type))
|
||||
else:
|
||||
|
@ -26,9 +26,14 @@ class HTTPLexer(RegexLexer):
|
||||
tokens = {
|
||||
'root': [
|
||||
(r'\s+', token.Text),
|
||||
# Request-Line
|
||||
(r'([A-Z]+\s+)(/.*?)(\s+HTTP/[\d.]+)', bygroups(
|
||||
token.Keyword, token.String, token.Keyword)),
|
||||
# Status-Line
|
||||
(r'(HTTP/[\d.]+\s+)(\d+)(\s+.+)', bygroups(
|
||||
token.Operator, token.Number, token.String)),
|
||||
(r'(.*?:)(.+)', bygroups(token.Name, token.String))
|
||||
token.Keyword, token.Number, token.String)),
|
||||
# Header
|
||||
(r'(.*?:)(.+)', bygroups(token.Name, token.Keyword))
|
||||
]}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user