Interact with the currently focused flow in a command


#1

I’d like to create a command that edits the current flow. What I do not see is a way to grab the currently focused flow, without first “selecting” it.

In my script it’d be great, if I could simply do something like executing:

@command.command("intercept.noresponse")
def cutter(
    self,
    code: int
) -> None:
    focusedFlow = ctx.master.commands.call("flow.resume @focus")
    focusedFlow.response.content = b''
    focusedFlow.response.status_code = code

When I run the first command in my script, I get the following error: ‘Unknown command flow.resume @focus

The same happens if I try to call:
focusedFlow = ctx.master.commands.call(“flow.resume”, ["@focus"])

I realize I can do this pretty quickly with a normal addon and a filter, but I was curious if there was a way to handle this in a custom command.

Giving our testers access to commands like this that don’t require any custom command lines, would be a great way to get everyone on the same page on how to properly edit responses. We commonly get bugs after testers modify requests they have intercepted, because they didn’t quite edit things correctly (or enough).