Skip to content
Tutorials Center
My learning

Topics

Lesson 18 of 36 ยท Network Panel

Request Timing, Copy as cURL and HAR Files

Read request timing and initiator chains, copy requests as cURL or fetch, and export, parse and share HAR files safely, with runnable HAR and cURL stand-ins.

The last lesson of the Network chapter covers three practical skills: reading the timing and initiator data to understand why a request happened when it did, copying a request in a form you can run elsewhere, and exporting a HAR file so a colleague (or a tool) can analyze your recording. Along the way you will build small stand-ins that process the same data DevTools does.

The Timing tab

Select a request and open Timing. You see the phases from the waterfall lesson, with exact milliseconds, grouped into:

  • Resource Scheduling: Queueing.
  • Connection Start: Stalled, DNS Lookup, Initial connection, SSL.
  • Request/Response: Request sent, Waiting for server response (TTFB), Content Download.

Plus an explanation icon ("Explanation") describing each one. A few patterns to recognize:

  • Queueing is long: the browser had too many requests to the same host or the request had low priority. HTTP/2 and HTTP/3 reduce this; so does loading less.
  • DNS or SSL is long: the first request to a new domain pays the setup cost. Use fewer domains or add <link rel="preconnect"> for the important ones.
  • TTFB is long: the server (or something behind it, such as a database) is slow, or a proxy is. Frontend changes will not fix this.
  • Download is long: the payload is big. Compress, minify, resize images, or load it later.

Many requests also show a Server Timing section when the server sends a Server-Timing header, which lets your backend report its own phases (for example db;dur=53) to the browser.

The Initiator tab

The Initiator column and tab answer "who asked for this?". A request can be initiated by:

  • the HTML parser (a <script>, <link> or <img> tag),
  • another script (with a call stack of functions),
  • a CSS file (for fonts and background images),
  • a redirect or the browser itself (for the favicon).

Hover the initiator link to see the request chain: the page requested app.js, which requested /api/user, which triggered /api/orders. Chains like this are slow because each step waits for the previous one. Breaking the chain (preloading, fetching in parallel, or including data in the HTML) is one of the most effective performance fixes, and the initiator view is how you find it.

Copy as cURL, fetch and more

Right-click a request, open Copy, and pick:

  • Copy as cURL: a command with the URL, method, headers and body, ready for a terminal.
  • Copy as fetch: JavaScript you can paste into the Console and edit.
  • Copy as Node.js fetch, Copy as PowerShell, and variants (the list varies by version and platform).
  • Copy URL, Copy response, Copy stack trace.
  • Copy all as HAR and Copy all as cURL for the full list.

This is the fastest way to reproduce an API problem outside the browser: copy the call, run it in a terminal, change one header at a time until you find the culprit. Remember the copied command includes your cookies and tokens, so treat it as a secret.

Never paste a copied cURL command into a public issue or chat. It carries your session cookie or Authorization header, which gives others access to your account. Replace secrets with placeholders such as TOKEN first.

Stand-in: build a cURL command

A cURL string is built from a request's method, URL, headers and body. This stand-in does that from a request object, escaping single quotes the way a shell expects. It shows what "Copy as cURL" does conceptually, with a placeholder token instead of a real one.

JS Stand-in: request object to cURL

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The second command shows why quoting matters: the apostrophe in "it's" would end the shell string, so it is written as '\''.

HAR files

A HAR (HTTP Archive) file is a JSON file that records a network session. Use Export HAR (the download arrow in the Network panel) to save one, and Import HAR to load one into DevTools later. Tools such as WebPageTest, Charles, Fiddler and many analyzers read the same format.

The structure is:

JSON
{
  "log": {
    "version": "1.2",
    "creator": { "name": "WebInspector", "version": "537.36" },
    "pages": [ { "id": "page_1", "title": "https://site.example/" } ],
    "entries": [
      {
        "startedDateTime": "2025-01-01T10:00:00.000Z",
        "time": 215.4,
        "request":  { "method": "GET", "url": "...", "headers": [], "queryString": [] },
        "response": { "status": 200, "content": { "size": 12345, "mimeType": "text/html" }, "headers": [] },
        "timings":  { "blocked": 1, "dns": 12, "connect": 30, "ssl": 25, "send": 0, "wait": 120, "receive": 27 }
      }
    ]
  }
}

Each entry is a request. The timings object matches the Timing tab phases (some values can be -1 when a phase did not apply, for example when a connection was reused).

Privacy: by default, exported HARs can contain cookies, tokens and form bodies. Recent Chrome versions offer Export HAR (sanitized), which removes sensitive headers, and you can also edit the file or review it before sharing. Treat unsanitized HARs like passwords.

Stand-in: analyze a HAR

Because HAR is JSON, you can analyze it with a few lines of code. This stand-in reads a small sample HAR, finds the slowest requests, sums bytes by MIME type and calculates the average time to first byte. The sample data is invented.

JS Stand-in: summarize a HAR

Press Run (or Ctrl + Enter) to see the console output here.

No output.

You could extend this with the -1 rule (skip phases that did not apply) or sort by receive to find the heaviest downloads. This is how performance tools produce their reports.

Stand-in: removing secrets before sharing

Here is a small sanitizer that redacts sensitive headers from a HAR-like object. Real sanitized export does this for you, but writing it once makes it clear what to look for.

JS Stand-in: redact sensitive headers

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Putting the chapter together

You now have a full network routine: record with the panel open, read status and headers, check caching, throttle and block to test failure modes, and finally measure phases, find chains, replay with cURL, and export a HAR when someone else must look. The same skills carry into the Performance and Lighthouse chapters, which build on this data.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A request spends most of its time in 'Waiting for server response'. What does that point to?

    Waiting is the time until the first byte arrives, driven by server and backend speed.
  2. 2. What does Copy as cURL include that makes it sensitive?

    The command contains the real request headers, including session credentials.
  3. 3. What is a HAR file?

    HAR (HTTP Archive) is a JSON format that many tools can read.
  4. 4. How does the Initiator view help performance work?

    Request chains delay later requests; seeing who started each one shows where to preload or parallelize.

Summary

  • Timing shows each phase; long queueing, connection, TTFB or download point to different fixes.
  • The Initiator chain explains why a request happened and exposes slow dependency chains.
  • Copy as cURL or fetch to reproduce requests; treat copied credentials as secrets.
  • HAR files are JSON recordings you can analyze, import and share after sanitizing.

Next: A Tour of the Performance Panel