Skip to main content

Pause & Edit

note

This functionality is only available on Tweak Max. Compare the plans here.

Pause & Edit holds a request the moment one of your rules matches it, and lets you change it right there on the page before anything else happens. Use it when the next request is the one you want to bend: another URL, another body, another header, another response, just this once. You fix the one request in front of you, continue, and the page carries on with your edit.

It works on Mock and Modify rules. Previously called Edit before send.

Switching it on​

Mock and Modify rules carry a Pause & Edit control in their debugging group, next to the breakpoint. Pick where the rule should pause:

OptionWhat pauses
Pause the requestthe request, before it leaves the page
Pause the request and responsethe request first, then the response before the page reads it
Pause the responsethe response only, before the page reads it

While it is on, a small req, both or res caption under the icon reminds you where the rule pauses.

the Pause & Edit menu on a modify rule, set to pause the request and response

What happens on a match​

When the page sends a matching request, tweak holds it and opens an editor on the page itself, in the tab you are looking at. The popup does not need to be open. The editor is the rule as you know it from the popup, showing only the side that is paused: the request tabs while the request is held, the response tabs while the response is.

On a Modify rule you edit the live request, not the rule's settings: the URL and body about to go out, or the body the server just answered. The editor's Format button works on that body too, so a minified payload is one click from readable. A Mock rule has no server, so its response pause comes right after its request pause.

The request is held: here the body about to go out is edited to ask for 99 items.

a paused request, framed over the page, with its body edited before it is sent

With the response paused too, the server's answer waits for you before the page reads it: here, edited into an out-of-stock error to see how the page copes.

a paused response, framed over the page, edited before the page reads it

Then pick one:

  • Continue request / Deliver response (Ctrl/⌘ + Enter): it goes on with your edits.
  • Send without edits / Deliver without edits: it goes on with the rule as saved.
  • Cancel request: it stops there, as an abort. See cancelling a request below.

If several matching requests arrive at once, they wait in line and the editor tells you how many are queued.

Cancelling a request​

Cancel request is how you test what your app does with a request that never gets an answer: a user navigating away, a timeout, a search superseded by the next keystroke. It is there at both stages, so you can cancel before the request goes out or after the server answered but before the page reads it.

The page sees exactly what an aborted request looks like in the browser, not an invented error:

The page sent it withWhat the page sees
fetchthe promise rejects with an AbortError
XMLHttpRequestthe usual abort: readyState reaches done with status 0, then abort and loadend

So the code that runs is your app's own cancellation path, the same catch or onabort handler a real abort would reach. Nothing is changed in the rule, and the next matching request pauses again as usual.

edits apply to this request only

Nothing you change in the editor is saved to the rule. Fixing one request in the moment should not change what the rule does for every request after it. To change the rule itself, edit it in the popup.

Good to know​

  • Synchronous XHR is never paused. A synchronous request cannot wait for you, so it goes out with the rule as stored.
  • A rule's request hook still runs, after the pause.

Pause & Edit or breakpoint?​

They are two switches and you can use either, or both. The breakpoint stops your app's code in the browser devtools so you can follow the request through it. Pause & Edit stops the request itself and hands it to you to change, with no devtools needed.



Was this page helpful?

Need something else? Request a feature