Reference

HTTP & network inspection

Decode requests, responses, browser rules and network diagnostics.

Scope and conventions

Wire examples use HTTP/1.1 notation; HTTP/2 and HTTP/3 encode it differently. Commands use a Unix-like shell and illustrative example.test hosts. Browser security behavior is labeled separately from HTTP and command-line clients.

Messages & URLs

Read a request

HTTP & tools

A request has a method, target, headers and optionally a body. An empty line separates headers from the body.

Fragment

HTTP & tools · Read a request
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
GET /items?limit=10 HTTP/1.1
Host: api.example.test
Accept: application/json

HTTP/1.1 requires Host. A fragment such as #details is not sent in the request target.

Read a response

HTTP & tools

The status describes the result; headers describe metadata and handling. A response body can be absent even when a request succeeds.

Fragment

HTTP & tools · Read a response
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 2

{}

Separate URL components

HTTP & tools

Scheme selects the protocol; authority includes host and optional port. Path, query and fragment have different roles.

Fragment

HTTP & tools · Separate URL components
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
https://api.example.test:8443/items/42?q=red%20tea#details

scheme: https
host:   api.example.test
port:   8443
path:   /items/42
query:  q=red%20tea
fragment: details (client-side)

Encode each data layer deliberately

HTTP & tools

URL percent encoding, JSON string escaping and HTML escaping solve different problems. URLSearchParams encodes query values; do not concatenate raw user input into a URL.

Fragment

HTTP & tools · Encode each data layer deliberately
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
const url = new URL("https://api.example.test/items");
url.searchParams.set("q", "red tea & milk");
const body = JSON.stringify({ text: "line\nnext" });

The source escape \n represents a newline; JSON.stringify then escapes that character for JSON.

Distinguish origin and site

HTTP & tools

An origin is scheme + host + port. Paths do not change it. Browser same-site cookie rules use a site notion based on scheme and registrable domain, which is different from origin.

Fragment

HTTP & tools · Distinguish origin and site
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
https://app.example.test
https://api.example.test
# Different origins; potentially same-site.