📜 Reading HTTP Specs
5 exercises — read real passages from the HTTP RFCs (7231/7232/7234) and interpret safe vs idempotent methods, conditional requests, caching directives and status-code semantics.
HTTP spec vocabulary
- Safe → read-only intent (GET, HEAD, OPTIONS, TRACE)
- Idempotent → repeating it has the same effect (PUT, DELETE + safe methods)
- Conditional request → If-Match / If-None-Match gate the method on an ETag
- Cache directive → no-store, must-revalidate, max-age control reuse
- Read the keyword: MUST NOT perform vs SHOULD return are different strengths
0 / 5 completed
1 / 5
RFC 7231 — Idempotent Methods
RFC 7231 — HTTP/1.1: Semantics and Content
Section 4.2.2. Idempotent Methods
A request method is considered "idempotent" if the intended effect on
the server of multiple identical requests with that method is the
same as the effect for a single such request. Of the request methods
defined by this specification, PUT, DELETE, and safe request methods
are idempotent.
Like the definition of safe, the idempotent property only applies to
what has been requested by the user; a server is free to log each
request separately, retain a revision control history, or implement
other non-idempotent side effects for each idempotent request. A client sends the same
DELETE /users/42 request twice because the first response timed out. Based on this section, is that safe to do?DELETE is idempotent, so safe to retry:
The section lists
The section lists
PUT, DELETE and the safe methods as idempotent: "the intended effect on the server of multiple identical requests... is the same as the effect for a single such request." Deleting user 42 once or five times leaves the resource gone — the end state is identical.- Idempotent → PUT, DELETE, GET, HEAD, OPTIONS, TRACE
- NOT idempotent → POST (each call may create a new resource), PATCH (depends)
Next up: Reading Protocol Specs →