Here's a preview from my zine, HTTP: Learn your browser's language!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
Every HTTP request has a method. It’s the first thing in the first line:
GET /cat.png HTTP/1.1
GET
means it’s a GET
request
There are 9 methods in the HTTP standard. 80% of the time you’ll only use 2 (GET
and POST
).
GET
When you type an URL into your browser, that’s a GET
request.
examplecat.com/cat.png
client, represented by a box with a smiley face:
GET /cat.png
Host: examplecat.com
server, also represented by a box with a smiley face:
200 OK
Content-Type: image/png
<the cat picture>
POST
When you hit submit on a form, that’s (usually) a POST
request.
client:
POST /add_cat
Content-Type: application/json
{"name": "mr darcy"}
(POST
requests usually have a request body)
server:
200 OK
Content-Type: text/html
<after sign up page>
The big difference between GET
and POST
is that GET
s are never supposed to change anything on the server.
HEAD
Returns the same result as GET, but without the response body.
client:
HEAD /cat.png
server:
200 OK
Content-Type: image/png
(no image, just headers)
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!