Skip to content

HTTP Request

An HTTP (Hypertext Transfer Protocol) request is a message sent by a client to a server to initiate an action on the web. When you type a URL into your web browser, the browser creates an HTTP request and sends it to the server that hosts the website you're trying to access. The server then processes the request and sends back a response, which might be the webpage you want to view, an error message, or something else.

Components of a HTTP request:
  • Request Line: This includes the HTTP method, the resource path, and the HTTP version. For example, GET /index.html HTTP/1.1.
  • Request Headers: These are key-value pairs that provide additional information about the request, such as the type of browser (user agent) making the request, accepted response formats (Accept headers), and other metadata.
  • Blank Line: A separator between headers and the body of the request, indicating that the headers section is finished.
  • Request Body: This is not present in all requests but is used when a client sends data to the server (like in a POST request), including form data, file uploads, etc.
HTTP methods:

There are several different HTTP methods, each indicating a different type of action or operation that the client wants the server to take:

  • GET: Requests data from the specified resource.
  • POST: Submits data to be processed to a specified resource.
  • PUT: Updates the specified resource with the data provided.
  • DELETE: Deletes the specified resource.
  • HEAD: Requests the headers that would be returned if the HEAD request's corresponding GET request was made.
  • OPTIONS: Asks for the communication options available for the target resource.
  • PATCH: Applies partial modifications to a resource.

Each HTTP request corresponds to a single action, and the server sends back an HTTP response that includes a status code (like 200 for a successful request or 404 for a page not found), response headers, and usually a response body containing the requested resource or a message.

For further detailed information on HTTP requests click here.

Action:

Custom request: Makes a custom HTTP request by providing raw details.