Let’s take a deeper dive into the client-server model through exploring a part of HTTP that you’ve probably seen before: HTTP status codes.
When a server responds to a client, the server specifies a status code as a part of the response. Status codes indicate whether or not the HTTP request was successfully completed and if there was an error, they contain some information about the type of error that happened. The status code helps the browser know how to handle the data that was sent back with the response.
Review the HTTP statuses below and see if any of them seem familiar.
The browser is currently displaying a website that Alex has created to show photos and descriptions of her pets. If you click on the links for
Cats, you can see more information about Alex’s dogs and cats.
Next, click on the file icon in the upper left corner of the text editor. You’ll see the different HTML files that the server is ready to send to the browser whenever those links are clicked. These HTML files correspond to the different web pages that are displayed in the browser. When the
Dogslink is clicked, the server will send the
dogs.htmlfile to the client.
Try out the
Let’s create a 404 status response by making a request for a non-existent resource. Alex hasn’t built a webpage to list her turtles! Click on the link for
Turtlesto see the browser display the 404 status code.