mirror of
https://github.com/httpie/cli.git
synced 2024-11-25 09:13:25 +01:00
parent
098257c0be
commit
963b2746f5
@ -10,7 +10,13 @@ DEFAULT_INDENT = 4
|
|||||||
class JSONFormatter(FormatterPlugin):
|
class JSONFormatter(FormatterPlugin):
|
||||||
|
|
||||||
def format_body(self, body, mime):
|
def format_body(self, body, mime):
|
||||||
if 'json' in mime or self.kwargs['explicit_json']:
|
maybe_json = [
|
||||||
|
'json',
|
||||||
|
'javascript',
|
||||||
|
'text',
|
||||||
|
]
|
||||||
|
if (any(token in mime for token in maybe_json) or
|
||||||
|
self.kwargs['explicit_json']):
|
||||||
try:
|
try:
|
||||||
obj = json.loads(body)
|
obj = json.loads(body)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
Loading…
Reference in New Issue
Block a user