HTTP Data Transfer Protocol

The HTTP protocol defines the rules for exchanging information between a client and a server on the Internet.

Every time we open a browser and enter a website address, we send an HTTP request to the server.

The server, in turn, returns an HTTP response with the contents of the requested page.

Data transfer around the globe

HTTP Request and HTTP Response

HTTP Request

An HTTP request includes:

HTTP method – the action the server should perform when processing the request
URL address – the path to the resource or page
Headers – information about the client: language, browser, etc.
Request body – data sent to the server (optional)
HTTP Response

An HTTP response contains:

Response status – a code that informs about the result of the request (e.g., 404 Not Found)
Headers – information about the response: content type (e.g., text, image), date, etc.
Response body – data returned to the client (e.g., a web page)

HTTP Methods

HTTP Method defines what kind of action the server will perform when processing the request.

Method What to do? Example
GET Retrieve Return a web page
POST Create Create a new user during registration
PUT Update/Create Update user settings, if they don’t exist — create them
PATCH Partially update Change the password in the profile
DELETE Delete Delete the user profile

There are also several utility HTTP methods

Example of an HTTP request and HTTP response

The client sends an HTTP request to retrieve a web page

HTTP method GET
URL address https://tester-today.com/protocols
Header Accept-Language: en

Server processes the request and returns an HTTP response

Response status 200 OK
Header Content-Type: text/html
Response body Page content in HTML format

This is how information is exchanged between a client and a server via the HTTP protocol.

DevTools

Developer Tools

DevTools — these are built-in browser tools for debugging and testing network requests.

View the details of the request that is made when the current page is opened. Page is named "protocols".

  1. Open DevTools:
    • Windows/Linux — F12 or Ctrl + Shift + I
    • macOS — F12 or Cmd + Option + I
  2. Go to the Network
  3. Reload the current page
  4. Select the request with the name protocols
devtools
Task

Send an HTTP request to the server to store a new fortune cookie message in the warehouse:

  1. Specify the URL address
    https://www.tester-today.com/secret-storage
  2. Select the HTTP method for creation
  3. Enter a new wish in the field Request body
  4. Send the HTTP request
  5. The server will process the request and return a response

Explore the request and response details in DevTools → Network.

What HTTP status did the server return?
Sidebar arrow