# Testing with Postman: Headers

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](https://postman-quick-reference-guide.readthedocs.io/en/latest/index.html)
[Chai Assertion Library](https://www.chaijs.com/api/bdd/)
[Regex Cheat Sheet](https://www.rexegg.com/regex-quickstart.html)
[Postman: The Complete Guide on Udemy](https://www.udemy.com/postman-the-complete-guide/)
