Handling responses that don't parse

GET https://postman-echo.com/get?customer_id=6

If you cannot parse the response body to JavaScript because it's not formatted as JSON, XML, HTML, CSV, or any other parsable data format, you can still make assertions on the data.

You can test if the response body contains a string:

pm.test("Body contains string",() => {
  pm.expect(pm.response.text()).to.include("customer_id");
});

This does not tell you where the string was encountered because it carries out the test on the whole response body. You can also test if a response matches a string (which will typically only be effective with short responses):

pm.test("Body is string", function () {
  pm.response.to.have.body("whole-body-text");
});

Request Params

KeyDatatypeRequiredDescription
customer_idnumber