How to get the raw response body in Tests scripts?

Hi @damiengarrido/@shresthasu,

To get raw binary data there is a way in postman by extracting stream of data from pm.response object. You can use below snippet to extract the data and specify the byte stream.

const mark1 = (pm.response);
console.log(mark1.stream.toString('utf-8'));

To convert the byte stream to base64
console.log(btoa(mark1.stream));

Hope it helps :slight_smile:

4 Likes