HTTP
Overview
HTTP is the transport contract between browsers, APIs, proxies, and services.
Why It Matters
Frontend engineers debug HTTP constantly, even when they are not writing backend code.
Core Concepts
- Methods describe intent.
- Status codes describe outcome.
- Headers and cache semantics influence behavior.
Mental Models
Trace request and response boundaries before blaming the UI.
Best Practices
- Use the correct method.
- Inspect status, headers, and payload together.
- Respect caching and redirect behavior.
Common Mistakes
- Treating every
200as success in the UI. - Ignoring
204, redirects, and caching. - Assuming network failures are always client-side.
Trade-offs
HTTP is simple at the surface and subtle in production. The more layers involved, the more important the exact response details become.
Decision Framework
| Response | Usually check first |
|---|---|
2xx | UI logic and data mapping |
3xx | Routing, auth, caching |
4xx | Payload, auth, validation |
5xx | Backend logs and dependencies |
Examples
GETshould not mutate state.204means no response body should be expected.
Checklists
- Is the method appropriate?
- Did I inspect headers and payload?
- Is caching affecting what I see?
Senior Engineer Notes
Senior engineers treat HTTP as a diagnostic surface. The status code is the start of the investigation, not the end.