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