Import a HAR exchange

A HAR can give you a response your application actually received. Select the API exchanges you need, remove private data, and seed them into a Gostly service for a focused replay check.

Start here when a browser or proxy capture contains the HTTP response you want to reproduce. Check that the export includes response content before importing it.

Before you start

Use the licensed self-hosted Gostly installation and its local operator dashboard. Have permission to manage an isolated example workspace and service. These instructions describe the licensed product, not the separate OSS proxy CLI. A synthetic file can be inspected without an installation; importing and checking it requires the running stack.

Follow Install & Deploy if the stack is not ready. Review the shared import data-handling contract before uploading.

Download and inspect the input

A synthetic HAR-shaped capture with one textual JSON exchange. Its reserved .invalid host makes the example inspectable without referring to a real service or account.

Download orders.har.json

Expected imported route: GET /orders/order_demo_001?view=summary. Expected response: 200 · application/json.

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "Synthetic guide example",
      "version": "1.0"
    },
    "entries": [
      {
        "startedDateTime": "2026-01-01T00:00:00.000Z",
        "time": 25,
        "request": {
          "method": "GET",
          "url": "https://orders.example.invalid/orders/order_demo_001?view=summary",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ],
          "queryString": [
            {
              "name": "view",
              "value": "summary"
            }
          ],
          "cookies": [],
          "headersSize": -1,
          "bodySize": 0
        },
        "response": {
          "status": 200,
          "statusText": "OK",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookies": [],
          "content": {
            "size": 51,
            "mimeType": "application/json",
            "text": "{\"id\":\"order_demo_001\",\"status\":\"ready\",\"total\":42}"
          },
          "redirectURL": "",
          "headersSize": -1,
          "bodySize": 51
        },
        "cache": {},
        "timings": {
          "send": 0,
          "wait": 25,
          "receive": 0
        }
      }
    ]
  }
}

Expected response body

{
  "id": "order_demo_001",
  "status": "ready",
  "total": 42
}

Prepare a safe source file

  • Capture only the request you need, then work from a copy. Remove SSO, analytics and unrelated host entries before sharing or uploading the file.
  • Review request headers and cookie arrays, the entire URL including query values, request bodies, response headers and response content. Replace credentials and personal data with synthetic values.
  • Open the export and check response.content.text. A HAR entry without stored response content produces an empty response body; the import does not fetch it again.

Import into the target service

  1. Choose the service boundary. For this file, create an empty service with Upstream URL https://orders.example.invalid, Routing Type Path and Routing Value /orders, without an overlapping route. With your own capture, the configured upstream host determines which HAR entries are kept.
  2. Import the small capture. Open Seed in the local operator dashboard, choose orders.har.json, select the service and HAR format, then Commit seed. The example's reserved .invalid host is treated as synthetic input.
  3. Inspect kept and skipped exchanges. Look for one added mock with the complete query string. Review warnings for other hosts, invalid entries or screened responses. A captured login page, challenge or rate limit can be excluded by default.
  4. Replay the same HTTP request. Switch the example service to MOCK. Pass the Gostly proxy origin as apiBase (http://localhost:8080 for the default local HTTP listener). The /orders path selects the service; keep the same path and query as the imported exchange.

For authenticated API uploads, use the parent's seeding endpoint instructions. A stored count does not prove the library is serving: an explicit reload rejection returns 502 after storage. Resolve the reload and inspect serving state before importing again.

Review options, warnings and the stored fixture

  • Deduplication defaults on and applies within this upload, not against existing stored rows. Reimporting can add rows.
  • The API-only methods and statuses options are comma-separated allow-lists. keep_other_hosts defaults false: host filtering uses the selected service's upstream host, including a configured port; no subdomain wildcard is applied. Without a readable upstream host, the most frequent captured host is used, with first-seen order breaking a tie. Relative URLs and reserved .invalid hosts remain eligible.
  • The API-only keep_flagged option defaults false. Detected challenges, sign-in pages/redirects, rate limits and errors inside 2xx bodies can be skipped. Read the returned warnings and flagged list. Imported latency is zero; captured request headers do not become matching rules.

Read the full option contract and errors and warnings. Check the selected service, exact method/path/query, request body, response status, headers and body before relying on the imported case.

What the source supplies

HAR field mapping and limits
Source fieldImport behavior
Request method, path and queryThe method and path/query become the mock route. Entries for other hosts are filtered against the selected service's upstream by default.
Response status, headers and contentTextual response content carries over with the captured status and response headers, subject to response screening and credential redaction.
Request bodyText from the captured request body carries over. Form parameters use a simple text representation; multipart uploads need a separate check.
Request headers and cookiesThese inform import screening and credential handling. They do not become saved request-header matching rules.
Timing, streaming and binary dataCaptured timings are not replay delays. WebSocket entries are skipped. The library stores bodies as text, so use this path for textual HTTP exchanges and check binary/streaming cases separately.

Check replay and application behavior

Save this JavaScript in your test harness and call the exported function with the Gostly proxy origin as apiBase. It is a reader-owned assertion; importing the file does not execute it. The reserved source hostname does not become the client base URL.

import assert from "node:assert/strict";

// Pass the base URL of your client configured to use Gostly.
export async function checkCapturedOrder(apiBase) {
  const response = await fetch(new URL(
    "/orders/order_demo_001?view=summary", apiBase
  ));
  assert.equal(response.status, 200);
  assert.deepEqual(await response.json(), {
    id: "order_demo_001",
    status: "ready",
    total: 42
  });
}

This assertion checks the synthetic HTTP response. Keep the original test's useful application assertion as well; the HAR's timestamps and duration are not an application timing test.

  • Confirm the expected host, method, path and query survived the import.
  • For a test upstream you control, deny live access or assert its request counter did not increase during replay.
  • Assert the parsed response and your application's resulting state. Configure any required delay or failure scenario separately.

Common questions

Why were fewer exchanges imported than my HAR contains?

The importer filters other hosts, skips invalid and WebSocket entries, and screens captured challenges, login pages, rate limits and errors carried inside success responses. Deduplication can also remove repeats within the upload. The result's warnings explain those decisions.

Will the HAR replay browser navigation and timing?

The import creates HTTP mocks. It does not replay the browser session, assets as a navigation workflow, captured timing, or WebSocket frames. Test those behaviors with the tools and scenarios that own them.

Does the importer remove all sensitive data?

Import applies credential redaction and a response-header floor before storage. That is not a general personal-data scrub. Review the source file before upload, including fields that will not be retained as replay matching rules.

Continue with your own case

Return to Seed a Mock Library for shared import, reload and storage behavior. Follow MOCK replay to inspect the response served to your application. Keep the useful client assertion as you expand coverage.