From c7eedcbc1a90e9705172ffd6333cb740a5e9883f Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Tue, 19 Nov 2019 18:29:22 +0100 Subject: [PATCH] fix 'set' to only accept a single argument --- mitmproxy/addons/core.py | 4 ++-- test/mitmproxy/addons/test_core.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mitmproxy/addons/core.py b/mitmproxy/addons/core.py index 6fb2bf1e4..8a3acedbb 100644 --- a/mitmproxy/addons/core.py +++ b/mitmproxy/addons/core.py @@ -83,14 +83,14 @@ class Core: ) @command.command("set") - def set(self, option: str, *value: str) -> None: + def set(self, option: str, value: str = "") -> None: """ Set an option. When the value is omitted, booleans are set to true, strings and integers are set to None (if permitted), and sequences are emptied. Boolean values can be true, false or toggle. Multiple values are concatenated with a single space. """ - strspec = f"{option}={' '.join(value)}" + strspec = f"{option}={value}" try: ctx.options.set(strspec) except exceptions.OptionsError as e: diff --git a/test/mitmproxy/addons/test_core.py b/test/mitmproxy/addons/test_core.py index 59875c2b6..e6924ead8 100644 --- a/test/mitmproxy/addons/test_core.py +++ b/test/mitmproxy/addons/test_core.py @@ -11,7 +11,7 @@ def test_set(): sa = core.Core() with taddons.context(loadcore=False) as tctx: assert tctx.master.options.server - tctx.command(sa.set, "server=false") + tctx.command(sa.set, "server", "false") assert not tctx.master.options.server with pytest.raises(exceptions.CommandError):