Test Overview
This test sends a GET request to a sample API endpoint and verifies that the response headers contain the expected Content-Type and Cache-Control values.
This test sends a GET request to a sample API endpoint and verifies that the response headers contain the expected Content-Type and Cache-Control values.
pm.test("Response headers contain expected values", function () { pm.response.to.have.header("Content-Type"); pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); pm.response.to.have.header("Cache-Control"); pm.expect(pm.response.headers.get("Cache-Control")).to.eql("no-cache"); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Postman is ready to send the request | - | PASS |
| 2 | Send GET request to the API endpoint | Request sent, waiting for response | - | PASS |
| 3 | Receive response with headers | Response received with headers including Content-Type and Cache-Control | - | PASS |
| 4 | Check if response has header 'Content-Type' | Headers available in response | Verify 'Content-Type' header exists | PASS |
| 5 | Verify 'Content-Type' header value includes 'application/json' | Header value is 'application/json; charset=utf-8' | Check header value contains 'application/json' | PASS |
| 6 | Check if response has header 'Cache-Control' | Headers available in response | Verify 'Cache-Control' header exists | PASS |
| 7 | Verify 'Cache-Control' header value equals 'no-cache' | Header value is 'no-cache' | Check header value equals 'no-cache' | PASS |