webview_network
Capture fetch and XMLHttpRequest traffic from WebViews in iOS simulators and export as JSON or redacted HAR log to debug network issues.
Instructions
Captures HTTP traffic made INSIDE a WebView (fetch + XMLHttpRequest) and exports it as JSON or a redacted HAR 1.2 log. This is the network-debugging path for WebView-based apps — RN shells that host their UI in a WKWebView, where the API calls run in the web layer so metro_network (CDP Network domain) captures nothing. It injects a fetch/XHR recorder into the page, captures for durationMs while you drive the app, then returns request/response metadata (url, method, status, headers, timing). Only requests made AFTER capture starts are recorded. format:'har' emits a valid HAR 1.2 log (HAR-lite — no response bodies) openable in Chrome DevTools → Import HAR; pass saveTo to write the .har file. Sensitive headers (authorization/cookie/…) and request bodies are REDACTED by default — set redact:false to keep them (don't commit unredacted HAR: it leaks tokens). Requires the app's WKWebView to be inspectable (isInspectable=true) — on by default in debug/staging builds, frequently disabled in production App Store builds.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | Yes | Simulator / device UDID | |
| webviewId | No | Target WebView id. Omit to auto-select the first visible WebView. | |
| durationMs | No | How long to capture (ms) while you drive the app (default 5000) | |
| format | No | Output format: 'json' (default, structured entries) or 'har' (HAR 1.2 log). | |
| saveTo | No | Optional file path to write the output (a .har file when format:'har'). | |
| redact | No | Mask sensitive headers (authorization/cookie/…) and request bodies. Default true. | |
| includeResources | No | Also include the browser's retroactive Performance Resource Timing list — EVERY request the document made since navigation, including ones that fired before capture started (URL + timing + size, but no headers/body). Default true. Set false for fetch/XHR only (with full headers + bodies). |