An HTTP response code is a numeric indicator of how an HTTP request turned out. In API work, a 200 response code confirms that the endpoint was reached successfully, giving developers a quick signal that the request and basic response path are working. section 4.7 section 10.2.3
Use response-code assertions to make endpoint checks repeatable:
- Send a request to an endpoint such as /files or /api/v1/companies. section 4.7 section 10.2.3
- Assert that the response status is 200 before relying on the returned data. section 4.7
- Combine the status check with response-format and content checks, such as JSON, required properties, and expected array length. section 4.7
- Run the same assertion in an isolated automated environment so endpoint tests remain self-contained for CI/CD. section 10.2.3
Listing 4.13 Sample Postman test
pm.test("Response should be JSON and have a 200 status code", function () {
pm.response.to.be.json; #1
pm.response.to.have.status(200); #2
});
A minimal Postman test checks both that the response is JSON and that its HTTP response code is 200. section 4.7
Testing a company-list endpoint
An automated test can call /api/v1/companies and assert response.status_code == 200. This confirms that the endpoint is reachable while Testcontainers supplies a fresh database environment, separating connectivity failures from persistent local-state problems. section 10.2.3










