0
0
Postmantesting~20 mins

Response size in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Response Size Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
What is the response size in bytes?
You send a GET request to an API endpoint that returns the JSON: {"name":"Alice","age":30}. Postman shows the response size as 25 bytes. What does this size represent?
AThe size of the response body in kilobytes, rounded to the nearest integer.
BThe size of the response headers only, excluding the body.
CThe size of the response body compressed with gzip.
DThe total size of the response body in bytes, including all characters in the JSON string.
Attempts:
2 left
💡 Hint

Think about what Postman counts as response size when showing it in the interface.

assertion
intermediate
1:30remaining
Which assertion correctly checks response size?
You want to write a test in Postman to verify that the response size is less than 1 KB. Which assertion code snippet is correct?
Apm.test('Response size is less than 1KB', () => { pm.expect(pm.response.size()).to.be.below(1024); });
Bpm.test('Response size is less than 1KB', () => { pm.expect(pm.response.responseSize).to.be.below(1024); });
Cpm.test('Response size is less than 1KB', () => { pm.expect(pm.response.size).to.be.below(1024); });
Dpm.test('Response size is less than 1KB', () => { pm.expect(pm.response.body.size()).to.be.below(1024); });
Attempts:
2 left
💡 Hint

Check the Postman API for the correct method to get response size.

🔧 Debug
advanced
2:00remaining
Why does this Postman test fail to check response size?
Consider this Postman test code:
pm.test('Response size check', () => { const size = pm.response.responseSize; pm.expect(size).to.be.below(2048); });

Why does this test fail even when the response size is below 2048 bytes?
Postman
pm.test('Response size check', () => { const size = pm.response.responseSize; pm.expect(size).to.be.below(2048); });
AThe test fails because pm.expect requires a callback function, not a direct value.
BThe response size is measured in kilobytes, so 2048 is too small a limit.
Cpm.response.responseSize is undefined; the correct method is pm.response.size() to get the response size.
Dpm.response.responseSize returns the size of headers only, not the body.
Attempts:
2 left
💡 Hint

Check the Postman scripting API for the correct property or method to get response size.

🧠 Conceptual
advanced
1:30remaining
What does Postman include in response size measurement?
When Postman shows the response size for an API call, which parts are included in this size measurement?
AThe combined size of response headers and body in bytes.
BOnly the response body size in bytes, excluding headers and status line.
COnly the size of response headers in bytes, excluding the body.
DThe size of the response body compressed with gzip if compression is enabled.
Attempts:
2 left
💡 Hint

Observe what the 'Size' field shows in the Postman response view.

framework
expert
2:00remaining
How to programmatically log response size in Postman tests?
You want to log the response size in bytes to the Postman console after each request. Which code snippet correctly does this?
Aconsole.log(`Response size: ${pm.response.size()} bytes`);
Bconsole.log('Response size: ' + pm.response.responseSize + ' bytes');
Cconsole.log(`Response size: ${pm.response.body.size} bytes`);
Dconsole.log('Response size: ' + pm.response.getSize() + ' bytes');
Attempts:
2 left
💡 Hint

Check the Postman scripting API for the method that returns response size.