Paths/Backend Engineer/HTTP & Networking / Request Lifecycle
Choose Methods That Are Safe to Retry
A client will retry what it is not sure about, so the method you choose decides whether a retry duplicates an order. Write the contract.
Validator
IDLE — checks run live as you type commands; submit when done
01Requirements
live checks- Directory ~/http exists○
- File ~/http/api-contract.yaml exists○
- The file lists the methods and what each one does○
- The file marks which methods are idempotent○
02Walkthrough
3 steps- 01
Create the http directory
The wire contract is a document, not a memory.
mkdir -p ~/http - 02
Write the method contract
GET reads, POST creates, PUT replaces, PATCH changes part of it, DELETE removes. The verbs carry the retry semantics.
echo 'methods:\n - method: GET\n purpose: read a resource\n idempotent: true\n - method: POST\n purpose: create a resource\n idempotent: false\n - method: PUT\n purpose: replace a resource\n idempotent: true' > ~/http/api-contract.yaml - 03
Verify and submit
cat the contract, then submit for validation.
cat ~/http/api-contract.yaml
03Stuck?
0 of 3 revealedTake a hint without losing the lab — each one points at the thing to look at, not at the answer.
04AI Tutor
guides, never solvesTell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?
04Notebook
saved locally in this browserlearner@lab — ubuntu:24.04
Session is disposable
↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list