Think about what Postman counts as response size when showing it in the interface.
Postman shows the response size as the total number of bytes in the response body, including all characters in the JSON string. It does not count headers or compressed sizes unless explicitly noted.
Check the Postman API for the correct method to get response size.
The correct method to get the response size in Postman scripts is pm.response.size(). The other options use incorrect properties or methods.
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?
pm.test('Response size check', () => { const size = pm.response.responseSize; pm.expect(size).to.be.below(2048); });
Check the Postman scripting API for the correct property or method to get response size.
pm.response.responseSize is not a valid property. The correct way to get the response size is by calling pm.response.size() method.
Observe what the 'Size' field shows in the Postman response view.
Postman shows the response size as the size of the response body in bytes, excluding headers. Headers size is shown separately.
Check the Postman scripting API for the method that returns response size.
The method pm.response.size() returns the response size in bytes. Other options use invalid properties or methods.