Ben Weese

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 () {“Content-Type”, ‘application/pdf’);“Content-Disposition”);
pm.expect(postman.getResponseHeader(“Content-Disposition”)).to.contain(‘filename=”application.pdf”‘, ‘No application.pdf was passed.’)


Postman Quick Reference Guide
Chai Assertion Library
Regex Cheat Sheet
Postman: The Complete Guide on Udemy

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.