diff --git a/mitmproxy/controller.py b/mitmproxy/controller.py index 57c01f59f..ac7c6cbc4 100644 --- a/mitmproxy/controller.py +++ b/mitmproxy/controller.py @@ -161,7 +161,13 @@ NO_REPLY = object() def handler(f): @functools.wraps(f) def wrapper(*args, **kwargs): - message = args[-1] + if len(args) == 1: + message = args[0] + elif len(args) == 2: + message = args[1] + else: + raise ControlError("Handler takes one argument: a message") + if not hasattr(message, "reply"): raise ControlError("Message %s has no reply attribute"%message) diff --git a/mitmproxy/web/__init__.py b/mitmproxy/web/__init__.py index d90830d68..7fef6df18 100644 --- a/mitmproxy/web/__init__.py +++ b/mitmproxy/web/__init__.py @@ -211,7 +211,6 @@ class WebMaster(flow.FlowMaster): super(WebMaster, self).handle_error(f) self._process_flow(f) - @controller.handler def add_event(self, e, level="info"): super(WebMaster, self).add_event(e, level) self.state.add_event(e, level)