mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-24 04:14:57 +08:00
Add a simple parser for content type specifications.
This commit is contained in:
@@ -214,7 +214,18 @@ class u_parse_size(libpry.AutoTree):
|
||||
libpry.raises(ValueError, utils.parse_size, "ak")
|
||||
|
||||
|
||||
class u_parse_content_type(libpry.AutoTree):
|
||||
def test_simple(self):
|
||||
p = utils.parse_content_type
|
||||
assert p("text/html") == ("text", "html", {})
|
||||
assert p("text") == None
|
||||
|
||||
v = p("text/html; charset=UTF-8")
|
||||
assert v == ('text', 'html', {'charset': 'UTF-8'})
|
||||
|
||||
|
||||
tests = [
|
||||
u_parse_content_type(),
|
||||
uformat_timestamp(),
|
||||
uisBin(),
|
||||
uisXML(),
|
||||
|
||||
Reference in New Issue
Block a user