4 methods generally used
- GET retrieves data from the server
- POST sends data to the server
- PUT updates data already on the server
- DELETE removes data from the server
header and body
The body is stuff like the HTML page, JSON data, image date etc..
header
There are 3 main types of header
| general | response | request |
|---|---|---|
| request URL | Server | Cookies |
| request method | set cookie | Accept-xxx |
| status code | Content-Type | Content-Type |
| remote address | Content-length | length |
| referrer policy | Date | Authorization |
| User-Agent | ||
| Referrer |
These are the more common ones.
http status codes
There are many but the main division is hundreds: so 100 to 500. The most famous is 404.
- 1xx
- 2xx
- 3xx
- 4xx
- 5xx
Common status codes
These are important ones to memorize and understand.
| code | means | example |
|---|---|---|
| 200 | OK | request a page and it gives it |
| 200 | OK created | something was created, new blog post |
| 301 | moved to a new url | |
| 304 | not modified (cached version) | |
| 400 | bad request | if you don’t send the correct data to the server |
| 401 | unauthorized | eg. missing a token |
| 404 | not found | |
| 500 | internal server error | could mean anything on the server side |
http/2
This is the updated version of http version 1.1. Faster more secure etc.
See codedamn Youtube vid too