mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Refine semantics of replay_request method.
This commit is contained in:
parent
04d9ec8c3c
commit
01b8b0d876
@ -1361,7 +1361,7 @@ class FlowMaster(controller.Master):
|
||||
if self.stickycookie_state:
|
||||
self.stickycookie_state.handle_response(f)
|
||||
|
||||
def replay_request(self, f):
|
||||
def replay_request(self, f, block=False):
|
||||
"""
|
||||
Returns None if successful, or error message if not.
|
||||
"""
|
||||
@ -1382,7 +1382,8 @@ class FlowMaster(controller.Master):
|
||||
self.masterq,
|
||||
)
|
||||
rt.start() # pragma: no cover
|
||||
return rt
|
||||
if block:
|
||||
rt.join()
|
||||
|
||||
def run_script_hook(self, name, *args, **kwargs):
|
||||
if self.script and not self.pause_scripts:
|
||||
|
@ -26,20 +26,17 @@ class SanityMixin:
|
||||
l = self.master.state.view[0]
|
||||
assert l.response.code == 304
|
||||
l.request.path = "/p/305"
|
||||
rt = self.master.replay_request(l)
|
||||
rt.join()
|
||||
rt = self.master.replay_request(l, block=True)
|
||||
assert l.response.code == 305
|
||||
|
||||
# Disconnect error
|
||||
l.request.path = "/p/305:d0"
|
||||
rt = self.master.replay_request(l)
|
||||
rt.join()
|
||||
rt = self.master.replay_request(l, block=True)
|
||||
assert l.error
|
||||
|
||||
# Port error
|
||||
l.request.port = 1
|
||||
rt = self.master.replay_request(l)
|
||||
rt.join()
|
||||
rt = self.master.replay_request(l, block=True)
|
||||
assert l.error
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user