galex5445
(alex g)
1
Hello! How can I get raw body response in pre-request script from request in pre-request script?
For example:
Pre request script
const req = {
url: 'http://www.google.com',
method: 'GET'
};
pm.sendRequest(req, function (err, response) {
console.log(response);
});
How to print to console raw BODY response from request in pre request?
Similar to the way you get the response from a normal request.
console.log(response.json());
galex5445
(alex g)
3
Thank you. I’ve expected an HTML in the body response and in my case response.text()
helped me
1 Like
Yes, sorry, Google.com would return an HTML page, which you parse with text() instead of json().