Skip to main content

Command Palette

Search for a command to run...

Testing with Postman: Headers

Updated
1 min read
Testing with Postman: Headers
B
I build automation frameworks — not just tests. Over 10 years I've designed and shipped production testing platforms across payment, insurance, and healthcare domains. My instinct is always toward architecture: clean abstractions, maintainable patterns, and systems that don't fall apart when the product scales. What I'm working on now: - A Claude/Playwright agent framework that generates test cases directly from Jira tickets - Concurrency and race-condition coverage for financial transactions - A modular Playwright/JavaScript platform covering UI and 20+ API service integrations with 100+ JSON schema validators I've built production automation in Playwright, Geb/Spock, Rest-Assured, and Selenium across payment, insurance, and healthcare domains. When a stack isn't working, I replace it. When a pattern is wrong, I fix it. If the automation problem is interesting, I'm probably already thinking about it.

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

More from this blog

B

Ben Weese - Senior QA Engineer

13 posts

As the son of a programmer I grew up on computers and have always loved them. Now I work as a Software Development Engineer in Test to write code and test things. I also enjoy my homelab hobby.