HAR 到 Postman 集合转换器
指导
HAR 到 Postman 集合转换器
Browser DevTools, Charles Proxy and mitmproxy all let you save captured traffic as a HAR (HTTP Archive) file, but Postman cannot import HAR directly. This converter rewrites a HAR export into a Postman Collection v2.1 JSON file in your browser, so you can replay every captured request as a real Postman call — headers, query string, body and example response included.
如何使用
- Export traffic from Chrome / Firefox / Edge DevTools (Network tab → right-click → “Save all as HAR with content”) or from Charles, Fiddler, mitmproxy, Insomnia.
- Drop the
.harfile onto the uploader or paste the JSON into the text area. - Pick how to group requests — by hostname, by first path segment, or no folders.
- Optionally filter out static assets, non-API requests or specific status / method codes.
- 点击 复制 to copy the Postman Collection JSON, or Download .json to save it as
name.postman_collection.json. - In Postman, choose File → Import and drop the file (or paste the JSON as raw text).
特征
- Postman Collection v2.1 output – Generates collections that import cleanly into Postman, Insomnia, Bruno, Hoppscotch and any other tool that speaks the v2.1 schema.
- Smart grouping – Choose between folders per hostname, folders per first path segment, or a single flat list of requests.
- Powerful filters – Drop static assets (CSS, JS, fonts, images, media) in one click, or narrow down to a single method, status tier or substring of the URL.
- Authorization → {{token}} – Replaces every
Authorizationheader value with a Postman variable so the JSON is safe to share with teammates. - {{baseUrl}} promotion – Detects the most common scheme + host in your capture and rewrites every request URL to
{{baseUrl}}/..., making it trivial to retarget the collection at staging or production. - HTTP/2 cleanup – Strips pseudo-headers (
:method,:authority,:path,:scheme) and theCookieheader by default, so the imported requests fire correctly from Postman. - Example responses included – Every imported request carries the captured response body and headers as a Postman example, so mock servers and tests work out of the box.
- 100% 客户端 – HAR files often contain authentication tokens and PII. Conversion happens entirely in your browser; nothing is uploaded to a server.
常问问题
-
What is a HAR (HTTP Archive) file?
HAR is a JSON-based open standard for archiving HTTP traffic. The W3C Web Performance Working Group defined it so different browsers and tools could share captures of network activity. A HAR file contains a top-level log object with pages metadata and an entries array — one entry per request, each with request, response, timings and serverIPAddress fields.
-
What is a Postman Collection v2.1?
Postman Collection v2.1 is the JSON schema Postman uses internally to represent a folder of saved requests. It supports nested folders, request bodies in multiple modes (raw, urlencoded, form-data, file, GraphQL), example responses, environments and variables. The schema is published at schema.getpostman.com/json/collection/v2.1.0/collection.json and is supported by every modern API client.
-
Why are :method, :path and similar headers stripped?
These are HTTP/2 pseudo-headers that browsers emit at the protocol layer instead of as real HTTP headers. They are not valid HTTP/1.1 header names and Postman cannot send them on an outgoing request. Including them would cause the imported requests to fail with header validation errors.
-
Why replace Authorization with a Postman variable?
HAR captures contain the exact bearer tokens and session cookies that were valid at capture time. Sharing that JSON exposes those secrets. Postman variables (the {{token}} syntax) defer the actual value to an environment, so the collection can be shared in a repository while every developer fills in their own credentials.
-
Why are response bodies sometimes missing in HAR exports?
The HAR specification makes the content.text field optional. Chrome and Firefox omit response bodies for binary assets and very large responses by default, and tools like Charles often require an explicit setting to record bodies. When the field is absent the converter still imports the request and headers — only the example response body is left empty.
