Test Overview
This test checks if the reusable test script correctly validates the response status and content type for an API endpoint. It verifies that the response status is 200 and the content type is JSON.
This test checks if the reusable test script correctly validates the response status and content type for an API endpoint. It verifies that the response status is 200 and the content type is JSON.
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Content-Type is application/json", function () { pm.response.to.have.header("Content-Type", /application\/json/); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and sends API request | Postman sends HTTP request to the API endpoint | - | PASS |
| 2 | Check if response status code is 200 | Response received with status code 200 | pm.response.to.have.status(200) | PASS |
| 3 | Check if Content-Type header includes 'application/json' | Response headers include Content-Type: application/json | pm.response.to.have.header("Content-Type", /application\/json/) | PASS |