Skip to Content
Navigation:

A stick figure smiling

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!

Image of a comic. To read the full HTML alt text, click "read the transcript".

browse more comics! get the zine!
read the transcript!

HTTP requests always have: - a domain (like examplecat.com) - a resource (like /cat.png) - a method (GET, POST, or something else) - headers (extra information for the server)

There’s an optional request body. GET requests usually don’t have a body, and POST requests usually do.

This is an HTTP 1.1 request for examplecat.com/cat.png. It’s a GET request, which is what happens when you type a URL in your browser. It doesn’t have a body.

GET /cat.png HTTP/1.1   
Host: examplecat.com   
User-Agent: Mozilla...   
Cookie: .....   

GET = method (usually GET or POST)
/cat.png = resource being requested
HTTP/1.1 = HTTP version examplecat.com = domain being requested, header
User-Agent: Mozilla… = header
Cookie: ..... = header

Here’s an example POST request with a JSON body:

POST /add_cat HTTP/1.1
Host: examplecat.com
content type of body
Content-Type: application/json
Content-Length: 20

{“name”: “mr darcy”}

POST = method
Host: examplecat.com = header
Content-Type: application/json = content type of body, header
Content-Length: 20 = header

{"name": "mr darcy"} = request body: the JSON we’re the server sending to

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2024 | All rights reserved (see the FAQ for notes about licensing)