04-backend-knowledge

HTTP

04-backend-knowledge/http

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 200 as 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

ResponseUsually check first
2xxUI logic and data mapping
3xxRouting, auth, caching
4xxPayload, auth, validation
5xxBackend logs and dependencies

Examples

  • GET should not mutate state.
  • 204 means 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.


Further Reading