mirror of
https://github.com/httpie/cli.git
synced 2025-06-28 21:41:47 +02:00
parent
e385ed6a99
commit
0f8d04b4df
@ -65,11 +65,11 @@ class ColorFormatter(FormatterPlugin):
|
|||||||
|
|
||||||
def get_lexer(mime):
|
def get_lexer(mime):
|
||||||
mime_types, lexer_names = [mime], []
|
mime_types, lexer_names = [mime], []
|
||||||
type_, subtype = mime.split('/')
|
type_, subtype = mime.split('/', 1)
|
||||||
if '+' not in subtype:
|
if '+' not in subtype:
|
||||||
lexer_names.append(subtype)
|
lexer_names.append(subtype)
|
||||||
else:
|
else:
|
||||||
subtype_name, subtype_suffix = subtype.split('+')
|
subtype_name, subtype_suffix = subtype.split('+', 1)
|
||||||
lexer_names.extend([subtype_name, subtype_suffix])
|
lexer_names.extend([subtype_name, subtype_suffix])
|
||||||
mime_types.extend([
|
mime_types.extend([
|
||||||
'%s/%s' % (type_, subtype_name),
|
'%s/%s' % (type_, subtype_name),
|
||||||
|
@ -39,6 +39,7 @@ class TestColors:
|
|||||||
'foo/bar+json',
|
'foo/bar+json',
|
||||||
'foo/json-foo',
|
'foo/json-foo',
|
||||||
'foo/x-json',
|
'foo/x-json',
|
||||||
|
'application/vnd.comverge.grid+hal+json',
|
||||||
])
|
])
|
||||||
def test_get_lexer(self, mime):
|
def test_get_lexer(self, mime):
|
||||||
lexer = get_lexer(mime)
|
lexer = get_lexer(mime)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user