Search code examples
apitestingpostmanpostman-testcase

Access complete response size in postman test?


Is it possible to access the complete response size in postman with response body and headers ?

I am able to use the below method to get the size of the response body only

pm.response.responseSize

it will return the size in bytes.

My test case in postman to get the response size looks like this.

pm.test("verify the response size of body", function() {
   pm.expect(pm.response.responseSize).to.be.equal(1024);
  
} );

Thank you in advance , if it is possible to get the size of complete response size from postman , since my API gateway does not support size of the response to be greater than 10MB and I am returning the encoded attachments in response, so I need to verify that the size of response does not cross the upperbound.


Solution

  • console.log(pm.request.size())
    console.log(pm.response.size())
    

    this gives you the computed size of request and response