Test Overview
This test sends a GET request to an API endpoint and verifies that the response headers contain the expected content type and server information.
This test sends a GET request to an API endpoint and verifies that the response headers contain the expected content type and server information.
pm.test("Response has correct Content-Type header", function () { pm.response.to.have.header("Content-Type"); pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); }); pm.test("Response has Server header", function () { pm.response.to.have.header("Server"); pm.expect(pm.response.headers.get("Server")).to.equal("nginx/1.18.0"); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Send GET request to the API endpoint | Request sent, waiting for response | - | PASS |
| 2 | Check if response has 'Content-Type' header | Response received with headers | Verify 'Content-Type' header exists | PASS |
| 3 | Verify 'Content-Type' header includes 'application/json' | Header value is 'application/json; charset=utf-8' | Check header value contains 'application/json' | PASS |
| 4 | Check if response has 'Server' header | Response headers available | Verify 'Server' header exists | PASS |
| 5 | Verify 'Server' header equals 'nginx/1.18.0' | Header value is 'nginx/1.18.0' | Check header value equals expected string | PASS |