Sometimes the only thing you need to test is a header. This is when a PDF or something else is returned. Below is how you can test a header.
Testing for Correct Headers and PDF Responses
Below are test you can run on headers. The great thing about this is it allows us to find out if a PDF was passed as that will be in the headers.
pm.test("Headers are correct", function () { pm.response.to.have.header("Content-Type", 'application/pdf'); pm.response.to.have.header("Content-Disposition"); pm.expect(postman.getResponseHeader("Content-Disposition")).to.contain('filename="application.pdf"', 'No application.pdf was passed.') })
Links
Postman Quick Reference Guide Chai Assertion Library Regex Cheat Sheet Postman: The Complete Guide on Udemy