What actually happens between fetch() and response.json()?
Per Wikipedia: “The request-response cycle is the full round trip — DNS, TCP, TLS, HTTP request, server handler, HTTP response, browser parse.”
Like ordering food — find restaurant address, travel there, place order, wait for kitchen, carry tray back.
- Resolve host via DNS
- Open TCP then TLS
- Send HTTP request line+headers+body
- Server routes and handles
- Return status+headers+body
- Stateless per request
- Keep-Alive reuses TCP
- 3 RTT before first byte with TLS
curl -v https://api.example.com- Built from: HTTP — cycle implements HTTP
- Built from: HTTP Headers — headers travel in cycle
- Related: HTTP Status Codes — status returned
- Builds into: CORS — CORS checked in cycle
- Assuming one TCP per request — keep-alive reuses
- Forgetting preflight in cycle