Sobes.tech
Junior — Middle

Describe the main components and format of an HTTP request.

sobes.tech AI

Answer from AI

An HTTP request consists of several main components:

  1. Request line — contains method (GET, POST, PUT, etc.), URI (resource address), and HTTP version.
  2. Headers — key-value pairs that convey additional information about the request, such as content type (Content-Type), content length (Content-Length), authorization data, etc.
  3. Blank line — separates headers from the body.
  4. Request body — optional part containing data sent to the server (e.g., form data or JSON).

Example of an HTTP request:

POST /api/users HTTP/1.1
Host: example.com
Content-Type: application/json
Content-Length: 48

{"name":"Ivan","email":"ivan@example.com"}
Describe the main components and format of an HTTP… - sobes.tech