NetPeek NetPeek

iOS Packet-Capture Scripts for Request and Response Automation

When a simple rewrite is not enough, NetPeek scripts can run JavaScript before requests, after responses, or on a schedule, while constants keep reusable environment URLs, tokens, and other values in one place.

5Scripts

When rules aren't enough, use JavaScript to handle matched requests more flexibly: read/rewrite request & response, gunzip bodies, compute values conditionally. Scripts are scoped by host and run in the tunnel, like rules.

  1. Tap + in the script list, set a name and scope (host).
  2. Write your logic in the editor (helpers like $utils provide gzip/gunzip etc.).
  3. Save & enable, then re-send the request to see the effect.
Open scripts New script

7Constants

Store frequently-used values (a mock JSON, a token, a test URL) as constants and reference them in rules with ${constantId} — change one place, update everywhere.

Open constants New constant
Simple-mode Mock already assembles the response for you, so you rarely need a constant by hand; constants shine when reused across several expert-mode rules.

FAQ

When should I use a script?

Use scripts for branching, combined transformations, or scheduled automation. Prefer rewrite rules for straightforward header, body, or mock changes.

Do scripts run automatically?

A script runs only when that script is enabled and the global Scripts gate is on.

What are constants for?

Constants centralize reusable values such as API endpoints or tokens so rules and scripts can share them.

Related features