Key takeaways
- A web app has a client (the browser or mobile app) that sends HTTP requests to a server, which sends back responses. Most bugs live on one side or the other, or in what travels between them.
- Every response has a status code: 2xx success, 3xx redirect, 4xx the client asked for something wrong, 5xx the server failed. Knowing them makes your bug reports far sharper.
- Cookies and sessions are how a site remembers who you are between requests. Many login, cart and security bugs live there.
Why testers need this
You can test a website without knowing how it works. But when something breaks, you'll only be able to say "the page doesn't work".
A tester who knows the basics can say: "Clicking Save sends a POST to /api/profile, which returns 500. The front end shows no error and the data isn't saved." That bug gets fixed in an hour, not a day. It's also a frequent interview topic: "What happens when you type a URL into the browser?"
Client and server
- The client is what the user touches: a browser, or a mobile app. It shows the interface and sends requests. This is the front end.
- The server is a computer somewhere else that receives requests, runs the business logic, reads and writes the database, and sends back responses. This is the back end.
They talk over the network using HTTP, or its encrypted version, HTTPS.
What happens when you open a page
- You type
https://shop.example.com/products?category=shoes. - DNS (the internet's phone book) translates
shop.example.cominto the server's IP address. - The browser opens a secure connection (that's the "S" in HTTPS).
- It sends an HTTP request: "GET me
/products?category=shoes". - The server processes it, maybe queries a database, and sends back a response: a status code, headers and a body (HTML, JSON, an image).
- The browser renders the page, and usually sends dozens more requests for styles, scripts, images and data.
Anatomy of a URL
https://shop.example.com:443/products/shoes?color=red&size=42#reviews
└─┬─┘ └──────┬───────┘└┬┘ └─────┬──────┘ └───────┬────────┘ └──┬──┘
scheme host port path query string fragment
Testers play with the query string all the time: change size=42 to size=-1, size=abc or remove it entirely, and see what happens.
HTTP requests: methods
| Method | Used for | Example |
|---|---|---|
| GET | Reading data | Load a product page |
| POST | Creating something | Place an order |
| PUT / PATCH | Updating something | Change your address |
| DELETE | Removing something | Delete a saved card |
A request also carries headers (extra information, like the language or the login token) and, for POST/PUT/PATCH, a body with the data, usually in JSON.
HTTP responses: status codes
| Code | Meaning | What it tells you as a tester |
|---|---|---|
| 200 OK | Success | Request worked. Still check the data is right. |
| 201 Created | Something was created | Typical after a successful POST. |
| 301 / 302 | Redirect | The page moved; the browser follows it. |
| 400 Bad Request | The request was invalid | Often a validation error. Is the message clear? |
| 401 Unauthorized | Not logged in | Session missing or expired. |
| 403 Forbidden | Logged in, but not allowed | Correct for permission checks; a bug if you should have access. |
| 404 Not Found | Nothing at this address | Broken link, or wrong ID. |
| 500 Internal Server Error | The server crashed | Almost always a bug. Report it with the request details. |
| 502 / 503 / 504 | Server unavailable or too slow | Infrastructure or a downstream service is down or overloaded. |
Cookies and sessions
HTTP doesn't remember anything between requests. So how does a site know you're logged in?
- After login, the server creates a session and sends the browser a cookie (a small piece of data) or a token.
- The browser sends it back with every request. The server reads it and knows who you are.
What testers check here: Does logout really end the session? Can you use the site after the session expires? Does the cart survive closing the browser? If you copy someone's session cookie, can you act as them? (That last one is a security question.)
Front end or back end? Locating the bug
| Symptom | Likely side |
|---|---|
| Button misaligned, text overlaps, wrong colour | Front end |
| Form accepts invalid data but the server rejects it with a 400 | Front-end validation missing (minor) |
| Server accepts invalid data and saves it | Back end (often serious) |
| Request returns 500 | Back end |
| Correct data in the response, but shown wrongly on screen | Front end |
You find out which by looking at the actual requests in the Network tab. See browser DevTools for testers.
On 4 October 2021, Facebook, Instagram and WhatsApp went offline worldwide for about six hours.
Facebook explained that a faulty configuration change on its backbone network routers triggered the outage. Analyses by Cloudflare and others showed the external effect: the routes to Facebook's DNS servers were withdrawn from the internet, so browsers and apps couldn't even find the address of facebook.com. Reports also said the outage took down internal tools, which slowed the recovery.
For users, every app simply "didn't load". For anyone who understood the layers, the symptom was specific: DNS lookups failing, so no HTTP request ever reached a server.
Lesson: "It doesn't work" can fail at many layers: DNS, connection, server, application, front end. Knowing the layers lets you say where it fails, which is half the diagnosis.
Do
"Clicking 'Apply coupon' with code SAVE10 sends POST /api/cart/coupon, which returns 500. The cart shows no error and the discount isn't applied. Request and response attached."
Don't
"Coupons are broken." No request, no code, no data, so the developer has to rediscover everything you already saw.
Check yourself
You open the URL of another user's order (/orders/1043) while logged in as yourself. You get a 200 response and see their order. What's wrong, and which status code would you expect instead?
Show answer
It's a serious security bug: you can see data that belongs to someone else (an access control problem). The server should refuse the request, usually with 403 Forbidden, or 404 Not Found to avoid revealing that the order exists. Report it immediately and with high severity.
