diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-12-19 10:09:14 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-12-19 10:19:08 +1300 |
commit | 6563feaf059f9c829ba6b57d312a0f1dbfb84e33 (patch) | |
tree | 6baebf45d24369be51964d6a628902e582a325c2 /mitmproxy/types.py | |
parent | cda14830d349f4c1c60af2d1ec563e4894b836c3 (diff) | |
download | mitmproxy-6563feaf059f9c829ba6b57d312a0f1dbfb84e33.tar.gz mitmproxy-6563feaf059f9c829ba6b57d312a0f1dbfb84e33.tar.bz2 mitmproxy-6563feaf059f9c829ba6b57d312a0f1dbfb84e33.zip |
types: use new type validation mechanism in commands
Diffstat (limited to 'mitmproxy/types.py')
-rw-r--r-- | mitmproxy/types.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mitmproxy/types.py b/mitmproxy/types.py index 713a0ae5..35d4ed7e 100644 --- a/mitmproxy/types.py +++ b/mitmproxy/types.py @@ -205,7 +205,15 @@ class _StrSeqType(_BaseType): return [x.strip() for x in s.split(",")] def is_valid(self, manager: _CommandBase, typ: typing.Any, val: typing.Any) -> bool: - return isinstance(val, str) + if isinstance(val, str) or isinstance(val, bytes): + return False + try: + for v in val: + if not isinstance(v, str): + return False + except TypeError: + return False + return True class _CutSpecType(_BaseType): |