Responses
Success and redirects
Choose common 2xx and 3xx status codes and understand how browsers follow Location headers or reuse cached responses.
8 minute lesson
~~~
Common success codes include:
200 OK: a general successful response.201 Created: a new resource was created.204 No Content: the request succeeded without a response body.
Redirects normally include a Location header:
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page
301 and 308 are permanent redirects. 302 and 307 are temporary. 307 and 308 explicitly preserve the request method; historical client behavior around 301 and 302 may turn a POST into a GET.
304 Not Modified belongs to the 3xx family but is not a normal redirect. It tells a client that its cached response is still valid.
Lesson completed