Complete the code to check if the response has the 'Content-Type' header.
pm.test('Content-Type header exists', function () { pm.response.to.have.header('[1]'); });
The header name to check is 'Content-Type'. This assertion verifies the response includes this header.
Complete the code to assert the 'Content-Type' header value equals 'application/json'.
pm.test('Content-Type is application/json', function () { pm.response.to.have.header('Content-Type', [1]); });
The assertion checks that the 'Content-Type' header value is exactly 'application/json'.
Complete the code to assert the 'Cache-Control' header equals 'no-cache'.
pm.test('Cache-Control equals no-cache', function () { pm.response.to.have.header('Cache-Control', [1]); });
The assertion must check that the 'Cache-Control' header contains the value 'no-cache'.
Fill both blanks to assert the response header 'Authorization' exists and its value is 'Bearer token123'.
pm.test('Authorization header check', function () { pm.response.to.have.header('[1]'); pm.expect(pm.response.headers.get('[2]')).to.eql('Bearer token123'); });
Both blanks require the header name 'Authorization' to check its presence and value.
Fill all three blanks to assert the response header 'Content-Type' exists and its value is 'application/json'.
pm.test('Content-Type header presence and value', function () { pm.response.to.have.header('[1]'); pm.expect(pm.response.headers.get('[2]')).to.eql('[3]'); });
The first blank is the header name to check presence ('Content-Type'). The second blank is the header name to get value ('Content-Type'). The third blank is the expected value ('application/json').