HTTP status codes with a brief look for both Testers and Developers
Rakibul Hasan
Sr. Software Engineer in Test | Test Automation Eng.| QA Engineer | Test Analyst | Security Tester | Agile Tester | Leadership
Have you ever clicked on a link only to be greeted by a '404 Not Found' message??
This is an HTTP status code in action—a critical part of web communication. Whether you're a developer, Tester, site administrator, or just curious about how the internet works, you need to understand what these status codes are and why they matter.
HTTP errors facilitate error handling and response codes, especially beneficial when dealing with services that adhere to strict standards and require precise information about the cause of an issue. Essentially, these codes serve as indicators of a failure in a URL request, conveying specific details about what went wrong.
An HTTP server can generate over 200 documented responses for a client. These codes encompass common success codes such as 200, as well as error codes like 404 and 500. While many of these error codes are self-explanatory, some may not be immediately obvious, particularly during the resolution process.
What is an HTTP Status Code?
An HTTP status code is a special message that a website sends to your computer when you try to open a web page. It tells you if everything is okay (like when you see a page), or if there's a problem (like when you see an error message). So, it's like a quick note from the website to let you know how things are going.
The status code is a standard way for servers to communicate with users (and vice-versa).
Categorization of Status Codes
There exist five categories of HTTP status codes, with each class containing responses that share similar or related meanings. Grasping these classifications can assist you in swiftly gauging the overall content of a status code before delving into the specific details
The most common HTTP status codes:
There are many different codes that servers use to talk to your computer on the internet but you won't see all of them a lot. Some are used a lot, and some not so much. Here are the ones you might see more often and a few that are not as common.
200?—?OK
This code means the request worked, and the server sent back the requested data successfully. It’s often used for things like images and documents.
201?—?Created
This code tells us that the request was accepted, but the processing is still in progress. It’s often used when a request takes time to finish, like in a long-running process.
202?—?Accepted
Indicates that the request has been received but not completed yet. It is typically used in log running requests and batch processing.
203?—?Non-Authoritative Information
If there’s something in between the client and server, like an HTTP proxy or a third party, that changes the responses before giving them to the client, the server will use a status code 203 to show that the response has been modified.
204?—?No Content
The server has fulfilled the request but does not need to return a response body. The server may return the updated meta information.
400?—?Bad Request
This code says the server can’t handle the request because there’s a problem with what the client sent. It could be because the file is too big, there’s a mistake in the request, the URL is wrong, or some other problem caused by another application. Sometimes, the server uses the 400 status code for any client-related issue, even if there’s a problem on the server side.
领英推荐
401?—?Unauthorized
This code shows a problem with the request or the data in it, like having wrong syntax or missing important information. When a server sends this response, it means it won’t do what was asked because the user or client doesn’t have the right permission.
402?—?Payment Required
This status code indicates an issue with authorization; if you’re making requests over HTTPS, you may receive this error if your browser doesn’t have access to your account. For more information on the 402 Payment Required error code
403?—?Forbidden
This code means there’s a problem with permissions on the server. It could be that you don’t have permission to open a specific file or folder on a website.
404?—?Not Found
This code says that there’s nothing at the web address you asked for. The thing you’re looking for isn’t there right now, but it might be back later, like when changes are made to a restful API.
409?—?Conflict
This code means the request couldn’t finish because there’s a problem with how things are right now. It’s like when you’re working on a document, and there’s a conflict that needs fixing before you can save your changes. For instance, a server uses this response if you’re trying to make, update, or delete something that already exists.
500?—?Internal Server Error
This shows that the server had its own problem. Something didn’t work right on the server, and it couldn’t give you what you wanted. This code usually comes from third-party plugins, mistakes in PHP, or when the connection to the database is not working.
501?—?Not Implemented
This means the server can’t do what the client is asking for. For example, if you try to use a part of a website or service that hasn’t been set up on the server or is being worked on, you might see this code.
502?—?Bad Gateway
This code is used when there's no way to handle your request. For instance, if there are no gateways or load balancers to manage your request, or if all the backend services are not working, like during a network outage.
503?—?Service Unavailable
This code is used when a service can’t handle requests for a little while. For example, if a service is dealing with too many requests or there’s a problem with the network, and it can’t respond at the moment.
504?—?Gateway Timeout
This code is used when a service can’t handle requests for a little while. For example, if a service is dealing with too many requests or there’s a problem with the network, and it can’t respond at the moment.
Conclusion
Web browsing and development rely on HTTP status codes. Knowing and understanding these codes can make your web experience better and help you solve problems faster. The next time you come across one, you’ll know exactly what it means!
You also can find it here at link.medium