An HTTP response is the message sent back from the server to the client (e.g., your browser) after processing a request. It typically consists of three parts:
- Status Line: The first line, indicating the HTTP version, status code, and a text description.
- Headers: Key-value pairs providing metadata about the response (e.g.,
Content-Type
,Content-Length
). - Body: The actual data being sent back, such as HTML, JSON, images, etc.
Here's a visual representation:
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 1234
<!DOCTYPE html>
<html>
<head>
<title>Example Page</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>