Sobes.tech
Middle

Can you briefly describe the structure of an HTTP request and HTTP response?

sobes.tech AI

Answer from AI

An HTTP request consists of:

  • Request Line: method (GET, POST, etc.), URL, and protocol version (e.g., HTTP/1.1).
  • Headers: key-value pairs conveying meta-information (e.g., Content-Type, Authorization).
  • Body: optional part containing request data (e.g., JSON in POST).

An HTTP response consists of:

  • Status Line: protocol version, status code (e.g., 200 OK).
  • Headers: meta-information about the response (e.g., Content-Type, Content-Length).
  • Body: response content, such as an HTML page, JSON, or a file.