HTTP Requests and Responses

Every page you load is a conversation: your browser asks, a server answers. Learn the anatomy of an HTTP request and response, with a real raw example you can read line by line.

Published September 15, 20269 min readBy ACY Partner Indonesia
HTTP Requests and Responses cover art with req to res code chip
300 × 250Ad Space AvailablePlace your ad here

Open any website and something quietly dramatic happens. Your browser sends a tiny message across the internet that essentially says “please give me this page,” and somewhere a computer you’ve never met sends a message back that says “here you go.” That back-and-forth is the beating heart of the web, and it has a name: the HTTP request and response.

You don’t need to be a network engineer to understand it. Once you can picture the two messages and the parts they’re made of, a huge amount of web development stops feeling like magic. In this article we’ll take both messages apart piece by piece, look at a real raw example, and give you a mental model you can reuse for the rest of your career.

The web is a conversation

HTTP stands for HyperText Transfer Protocol. A “protocol” is just an agreed-upon set of rules for how two parties talk so they understand each other. Think of two people who don’t share a language agreeing in advance: “I’ll ask in this exact format, you’ll answer in that exact format.” HTTP is that agreement for computers.

The two parties are usually called the client and the server. The client is the thing that starts the conversation by asking for something. Most of the time that’s your web browser, but it could also be a mobile app, or a small program running on a server. The server is the computer that holds the resource you want, such as a web page, an image, or some data, and sends it back.

   CLIENT                                 SERVER
 (your browser)                       (acy-partner.com)
      |                                      |
      |  ----------- REQUEST ----------->    |
      |   "GET me the page at /about"        |
      |                                      |
      |  <---------- RESPONSE -----------    |
      |   "200 OK, here is the HTML"         |
      |                                      |

One important detail: the client always speaks first. A server never randomly sends you a page out of nowhere; it only responds when something asks. Every request gets exactly one response. Ask once, get one answer. Keep that rhythm in mind, because it shapes everything else.

Anatomy of a request

A request is the message the client sends. It has up to four parts, and the first three are always present.

1. The method

The method is a single word that states what you want to do with the resource. It’s like the verb of your sentence. The most common ones are easy to learn:

Method What it means Everyday analogy
GET Fetch a resource, change nothing Reading a page in a book
POST Send new data to be created Mailing in a new form
PUT Replace a resource entirely Swapping a whole document
PATCH Update part of a resource Correcting one line
DELETE Remove a resource Throwing a file away

When you type a web address and hit enter, your browser sends a GET request. When you fill out a sign-up form and click submit, it usually sends a POST. The method tells the server your intent before it reads anything else.

2. The path

The path is the part of the address that comes after the domain name. If the full address is https://blog.acy-partner.com/en/about, then the path is /en/about. It tells the server which specific resource you’re asking about. The domain gets your message to the right building; the path points to the right room inside it.

3. The headers

Headers are extra lines of information, each written as Name: value. They’re like the notes you scribble on an envelope and the cover letter inside it: not the main message, but context the receiver needs. Headers can say which website you’re contacting (Host), what kind of program is asking (User-Agent), what response formats you can accept (Accept), and much more.

4. The body (optional)

The body is the actual payload of data you’re sending along, and it only appears when you have something to send. A GET request usually has no body, because you’re just asking for something, not handing anything over. A POST request that submits a form, on the other hand, carries that form’s data in its body.

A clean way to remember it

A request is: method (what to do) + path (which resource) + headers (context) + an optional body (the data you’re sending). Four parts, and the last one is only there when needed.

Anatomy of a response

The response is the server’s reply, and it mirrors the request closely. It has three parts.

1. The status code

The status code is a three-digit number that summarizes how things went, before you read a single word of the body. You’ve almost certainly seen 404 when a page doesn’t exist. That’s a status code. They’re grouped by their first digit:

Range Meaning Common examples
1xx Informational, hold on 100 Continue
2xx Success, it worked 200 OK, 201 Created
3xx Redirection, look elsewhere 301 Moved Permanently, 304 Not Modified
4xx Client error, you messed up 400 Bad Request, 401 Unauthorized, 404 Not Found
5xx Server error, the server messed up 500 Internal Server Error, 503 Service Unavailable

The pattern is worth internalizing: 2xx means good, 3xx means “go somewhere else,” 4xx points the finger at the request you sent, and 5xx means the server itself broke. Just by glancing at the first digit you already know the gist.

2. The headers

Just like the request, the response carries headers with Name: value lines. They describe the answer: what kind of content is coming back (Content-Type), how big it is (Content-Length), whether the browser may cache it, and so on. The browser reads these before the body so it knows how to handle what follows.

3. The body

The body is the actual content you asked for. For a normal web page that’s the HTML document. For an image it’s the image data. For an API it’s often JSON. The status code and headers tell you about the answer; the body is the answer.

A real request and response

Enough description. Here is what an actual exchange looks like in raw text, the way it travels over the wire. First, the request the browser sends:

GET /en/about HTTP/1.1
Host: blog.acy-partner.com
User-Agent: Mozilla/5.0
Accept: text/html
Accept-Language: en-US,en;q=0.9
Connection: keep-alive

Read it top to bottom. The first line packs three things: the method (GET), the path (/en/about), and the HTTP version (HTTP/1.1). Every line after that is a header. Since this is a GET, there’s no body; the message simply ends after the headers.

Now the server’s reply:

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 1024
Date: Mon, 15 Sep 2026 10:30:00 GMT
Server: nginx

<!DOCTYPE html>
<html>
  <head><title>About ACY Partner Indonesia</title></head>
  <body><h1>About us</h1></body>
</html>

The first line carries the status code: 200 OK, meaning success. The lines below are the response headers, telling the browser this is HTML, how long it is, and when it was sent. Then there’s a blank line, which is the universal signal “headers are done, the body starts now.” Everything after that blank line is the body, the HTML page itself.

That blank line is doing real work

In both messages, a single empty line separates the headers from the body. It isn’t decorative. It’s the agreed marker that says “no more headers, what follows is the payload.” Without it, a receiver couldn’t tell where the context ends and the content begins.

Now compare that to a request that does carry a body, like submitting a sign-up form for a user named Jane Doe:

POST /en/signup HTTP/1.1
Host: blog.acy-partner.com
Content-Type: application/json
Content-Length: 54

{"name": "Jane Doe", "email": "jane@example.com"}

Same shape: method, path, headers, blank line, and now a body holding the JSON data being sent. The server would reply with its own status code and headers, perhaps 201 Created to confirm the new account was made.

Why this model is worth keeping

Once this picture is in your head, large parts of web development click into place. When a page fails to load, you can ask sharper questions: was it a 4xx (something wrong with what I sent) or a 5xx (the server broke)? When you build a form, you understand why the data goes in the request body and why you choose POST over GET. When you read about APIs, REST, or fetch calls in JavaScript, you’ll recognize that they’re all just dressed-up versions of this same request-and-response dance.

The wonderful thing is how stable this knowledge is. Browsers, languages, and frameworks change constantly, but the core idea, ask in a known format and get an answer in a known format, has held steady for decades. Learn it once and it keeps paying off.

Recap

Let’s pull the whole thing back together:

  • The web works as a conversation between a client (which asks) and a server (which answers), using the rules of HTTP. The client always speaks first, and every request gets one response.
  • A request is made of a method (what to do), a path (which resource), headers (context), and an optional body (data being sent).
  • A response is made of a status code (how it went, summarized in three digits), headers (info about the answer), and a body (the answer itself).
  • Status code first digits are a quick map: 2xx success, 3xx redirect, 4xx your request was off, 5xx the server broke.
  • In the raw message, a blank line always separates the headers from the body.

From here, a natural next step is to look more closely at the methods themselves, especially the difference between GET and POST, or to explore what specific status codes are trying to tell you when things go wrong. Both build directly on the model you just learned, and both will make the next time a page misbehaves feel a lot less mysterious.

Tags:httprequestresponseweb-fundamentalsstatus-codeheaders
728 × 90Ad Space AvailablePlace your ad here

Related Articles

See All Articles

You Might Also Like

Browser compatibility and polyfills cover with code chip if not supported, polyfill
Web Fundamentals / Browsers

Browser Compatibility and Polyfills

Why the same web page can look or behave differently across browsers, and how feature support, progressive enhancement, polyfills, and transpilers help your site work everywhere.

Sep 15, 20269 min read
An Intro to Browser Developer Tools — ACY Partner Indonesia Blog
Web Fundamentals / Browsers

An Intro to Browser Developer Tools

Every browser hides a powerful toolkit behind one key. Meet DevTools and its main panels, and learn how they let you see the DOM, styles, network requests, and storage for yourself.

Sep 15, 202610 min read
Browser Security Basics cover with a same-origin shield code chip
Web Fundamentals / Browsers

Browser Security Basics: How Your Browser Quietly Protects You

A friendly, beginner-first tour of how your browser keeps you safe: the same-origin policy, tab sandboxing, the HTTPS padlock, mixed content, and a gentle intro to why input can be dangerous.

Sep 15, 202611 min read
Browser storage options shown on a dark ACY Partner blog cover
Web Fundamentals / Browsers

Browser Storage: Cookies, localStorage, and More

A beginner-friendly tour of where the browser keeps data: cookies, localStorage, sessionStorage, and IndexedDB. Learn what each one does and when to reach for it.

Sep 15, 20269 min read
Illustration of a browser engine running scripts through an event loop
Web Fundamentals / Browsers

How Browsers Handle JavaScript

A beginner-friendly look at how the browser parses, compiles, and runs JavaScript, why it has one main thread, and how script loading affects what you see on screen.

Sep 15, 20269 min read
Dark blue cover with the title How Browsers Work and a parse to layout to paint code chip
Web Fundamentals / Browsers

How Browsers Work: An Overview

A beginner-friendly tour of what your browser does between typing a URL and seeing a page: networking, parsing, the render tree, layout, paint, compositing, and the JavaScript engine.

Sep 15, 20269 min read