Challenge - 5 Problems
Response Headers Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
What is the value of the Content-Type header?
You send a GET request to an API endpoint. The response headers include:
What is the exact value of the Content-Type header?
Content-Type: application/json; charset=utf-8
Cache-Control: no-cache
What is the exact value of the Content-Type header?
Attempts:
2 left
💡 Hint
Look carefully at the full value after the colon in the Content-Type header.
✗ Incorrect
The Content-Type header specifies the media type and charset. Here it is 'application/json; charset=utf-8'.
❓ assertion
intermediate1:30remaining
Which assertion correctly checks the Cache-Control header?
You want to write a Postman test to verify the response header Cache-Control is exactly 'no-store'. Which assertion code is correct?
Postman
pm.test('Cache-Control is no-store', () => { pm.expect(pm.response.headers.get('Cache-Control')).to.eql('no-store'); });
Attempts:
2 left
💡 Hint
Header names are case-insensitive but use the exact header name casing for clarity.
✗ Incorrect
Option B correctly uses the exact header name and expected value. Option B uses lowercase header name but headers are case-insensitive, so it works but best practice is to use correct casing. Option B expects wrong value. Option B expects undefined which is incorrect.
🔧 Debug
advanced2:00remaining
Why does this Postman test fail to detect the X-RateLimit-Remaining header?
Consider this test code:
The test fails even though the response headers include:
What is the most likely reason?
pm.test('Rate limit remaining is 10', () => {
pm.expect(pm.response.headers.get('x-ratelimit-remaining')).to.eql('10');
});The test fails even though the response headers include:
X-RateLimit-Remaining: 10
What is the most likely reason?
Attempts:
2 left
💡 Hint
Check how Postman treats header name casing in the get() method.
✗ Incorrect
Postman header names are case-insensitive, but the get() method requires exact casing to find the header. Using lowercase 'x-ratelimit-remaining' does not match 'X-RateLimit-Remaining'.
🧠 Conceptual
advanced1:30remaining
What does the 'Access-Control-Allow-Origin' header control?
In API testing, what is the purpose of the 'Access-Control-Allow-Origin' response header?
Attempts:
2 left
💡 Hint
Think about browser security and cross-domain requests.
✗ Incorrect
The 'Access-Control-Allow-Origin' header tells browsers which domains can access the resource, enforcing Cross-Origin Resource Sharing (CORS) policy.
❓ framework
expert2:30remaining
Which Postman test code correctly asserts multiple response headers?
You want to check that the response headers include:
Which Postman test code correctly asserts both headers in one test?
Content-Type: application/json
Cache-Control: no-cache
Which Postman test code correctly asserts both headers in one test?
Attempts:
2 left
💡 Hint
Check which Postman assertion methods support multiple headers at once.
✗ Incorrect
Option D uses pm.expect with get() for each header and compares values correctly. Option D is invalid because pm.response.to.have.header() does not accept two calls in one test block like that. Option D uses .to.equal which is an alias but less common than .to.eql. Option D uses a method pm.response.to.have.headers which does not exist in Postman.