Back to Path
Beginner · 3 minModule 2 of 18
Request–Response Cycle
Communication in HTTP is always a two-way street consisting of a Request and a Response. A server never talks unless spoken to first.
Interactive Protocol Simulation
Step 1 / 6
Step 1 of 6
DNS
TCP
TLS
GET
CACHE
200
Resolve the host
Translate example.com into an IP address before any connection starts.
Worked example
Request
GET /api/user HTTP/1.1
Accept: application/jsonResponse
HTTP/1.1 200 OK
Content-Type: application/json
{"id": 1, "name": "John"}The client uses the "Accept" header to say "I only want JSON". The server looks at this and decides if it can provide that format.
The Request Breakdown
Every request contains three main parts:
- Request Line — The method (GET), the path (/about), and the version (HTTP/1.1).
- Headers — Metadata about the client (e.g., "I am a Chrome browser").
- Body — Optional data being sent (used in POST/PUT).
The Response Breakdown
The server answers with a similar structure:
- Status Line — The version and the status code (e.g., 200 OK).
- Headers — Metadata about the server and the data (e.g., "This is an image").
- Body — The actual content (HTML, Image, JSON).
Study kit
Module 2 of 18
Beginner · 3 min · 0 of 18 complete
Module status
Not completed yet
Notessaved locally+
Notes stay in this browser. They are not uploaded.
Suggest an editLearning graph
Prerequisites
Discussion
Loading discussion…
Sign in to ask a question.