1.1 KiB
1.1 KiB
Demo — Inspecting HTTP Traffic
This demo runs a minimal Express server that echoes back everything it receives — method, headers, body. Use it to see what a real HTTP request looks like from the server's perspective.
Setup
npm install
node server.js
Server runs on http://localhost:3000.
What to see
- Open
http://localhost:3000in the browser — see the GET request in DevTools Network tab, then see the same info echoed in the terminal - Submit the form at
http://localhost:3000/form— see the POST body appearing both in DevTools and in the terminal - Use curl to send a raw request and compare it to what the browser sends:
# Basic GET
curl -v http://localhost:3000
# POST with a body
curl -v -X POST http://localhost:3000/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=user&password=1234"
# See response headers only
curl -I http://localhost:3000
- See a
Set-Cookieheader by visitinghttp://localhost:3000/set-cookie, then show the cookie being sent back on the next request