# HTTP, Requests and Responses

> Learn the protocol your frontend and backend speak: methods, status codes, headers, cookies, caching and CORS. Free notes, key concepts, resources and a mini...

Canonical: https://www.internhack.in/roadmaps/tracks/full-stack/http-basics
Last updated: 2026-11-28

Learn the protocol your frontend and backend speak: methods, status codes, headers, cookies, caching and CORS.

Beginner · about 4 hours · difficulty 2/5

Learn first: [How the Internet and the Web Work](https://www.internhack.in/roadmaps/tracks/full-stack/how-the-internet-works)

Every feature you build is, in the end, an HTTP request and a response. Reading them fluently is the most useful debugging skill in full-stack work.

### Requests

A request has a **method**, a **URL**, **headers** and an optional **body**.

- **GET** reads, **POST** creates, **PUT/PATCH** updates, **DELETE** removes.
- GET should never change data. A "delete" link that uses GET will be triggered by link previewers and crawlers.

### Responses

- **2xx** success (200 OK, 201 Created, 204 No Content).
- **3xx** redirects (301 permanent, 302/307 temporary).
- **4xx** client mistakes (400 bad input, 401 not logged in, 403 not allowed, 404 not found, 409 conflict, 429 rate limited).
- **5xx** server faults (500, 502 bad gateway, 503 unavailable).

### Headers that matter daily

Content-Type, Authorization, Cookie and Set-Cookie, Cache-Control, and the CORS headers such as Access-Control-Allow-Origin. **CORS** is a browser rule: a page on one origin cannot read responses from another origin unless the server allows it. It is not a security feature of your API, and it does not apply to curl or Postman.

### Pitfalls

- Returning 200 with an error message in the body. Clients and monitoring tools rely on status codes.
- "Fixing" CORS with a wildcard on an API that uses cookies. It will not work, and it is the wrong fix.

You are ready to move on when you can open DevTools on any app, pick a request, and explain its method, status, key headers and why it succeeded or failed.

## Key concepts

- **HTTP methods and idempotency**
- **Status code families**
- **Headers and content types**
- **Cookies**
- **CORS**: A browser rule, not API security
- **Caching headers**
- **HTTP/2 and HTTP/3**
- **curl and Postman**

## Mini project

Use curl to call a public API (for example a GitHub user endpoint) with different methods and headers. Record five responses with different status codes and write one line on what each means.

## Check yourself

Your React app on localhost:5173 gets a CORS error calling your API on localhost:4000, but the same request works in Postman. Why, and where is the fix?

## Free resources

- [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP) (MDN)
- [What is HTTP?](https://www.cloudflare.com/learning/ddos/glossary/hypertext-transfer-protocol-http/) (Cloudflare)
- [curl documentation](https://curl.se/docs/) (curl)

Previous: [How the Internet and the Web Work](https://www.internhack.in/roadmaps/tracks/full-stack/how-the-internet-works) · Next: [Terminal and Command Line](https://www.internhack.in/roadmaps/tracks/full-stack/terminal-basics)

## More in Web Foundations

- [How the Internet and the Web Work](https://www.internhack.in/roadmaps/tracks/full-stack/how-the-internet-works)
- [HTTP, Requests and Responses](https://www.internhack.in/roadmaps/tracks/full-stack/http-basics)
- [Terminal and Command Line](https://www.internhack.in/roadmaps/tracks/full-stack/terminal-basics)
- [Git and GitHub](https://www.internhack.in/roadmaps/tracks/full-stack/git-and-github)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Full-Stack Developer Roadmap](https://www.internhack.in/roadmaps/tracks/full-stack)
