toPostman

fun toPostman(transactions: List<NetworkTransaction>, redaction: RedactionEngine? = null): String

A minimal, valid Postman Collection v2.1 built from the same redacted capture data as toHarTransactions: headers and bodies come straight off NetworkCapture, which has already been through NetworkCaptureFactory's redaction; redaction additionally re-applies the current policy at export time.

Requests identical in method, URL, headers, and request body and response status code and error presence (e.g. a polling endpoint hit a dozen times, all 200s) collapse to one representative item -- the newest one, by NetworkTransaction.startedAtEpochMs -- so a collection with one entry per request/response shape reads far better than one with every duplicate poll. The response status participates in the key so a 200 run and a 401 for the same request never collapse together; the response body deliberately does not, since bodies routinely carry timestamps or request-scoped ids that would otherwise defeat dedup entirely. One consequence: an explicit ?id= selection can still collapse rows the caller asked for by id, if they happen to share a dedup key -- selecting specific ids narrows which candidates are considered, not whether the dedup rule applies to them.