0%

http-message

Introduction

HTTP has two types of messages, request message and response message. Both messages consist of a start line, headers, and an optional body.

Note that, HTTP messages, as defined in HTTP/1.1 and earlier, are human-readable. In HTTP/2, these messages are embedded into a binary structure, a frame, allowing optimizations like compression of headers and multiplexing.

Request Message

http-request-message
Http Request message consists of the following elements:

  1. An HTTP method.
  2. The path of the resource to fetch.
  3. The version of the HTTP protocol.
  4. Optional headers.
  5. An optional body.

Response Message

http-response-message
Http Response message consists of the following elements:

  1. The version of the HTTP protocol.
  2. A status code indicating the success or failure of the request.
  3. A status message.
  4. Optional headers.
  5. An optional body.

Reference

  1. MDN - HTTP Messages