How do I remove a header via a script in headers tab?

Hey everyone, I have a header in every request in the headers tab, and now its useless, I cannot remove it manually because there are too many requests to count, how do I remove it via a pre-request script?

example header I wanna remove (not mine):

Hey @lunar-module-archit1 :wave:

Welcome to the Postman community :postman:

Is this something you could use in a pre-request script:

pm.request.headers.remove(headerName:String):function

Well this removes the param from the request being sent, not the Headers tab, I wanna remove the param once and for all. Any additional guidance would be greatly appreciated.

These are automatically generated request headers and cannot be deleted completely. The can be disabled or overridden with a new value.

I’m sorry I used a bad example, I my self added a new key and a new value, that are not generated automatically to every route during development, and now after an update I don’t want it anymore…

sorry again, I should’ve been more clear

You should be able to use this at the Collection level to prevent your manually added header from being sent in the requests.

Apart from manually deleting them in either the UI or exporting the file out to a text editor and doing it that way - There’s not a lot of options.

Using the Postman API might work but I don’t have a working solution to give you for this right now.

Thanks for the tip, I exported it and used replace all. and it works, I really think they should implement a function for this use case… just a suggestion you know

For feature requests, you can use the đź’ˇicon link in the site header, to submit those directly to the team. :heart:

It leads to this form where you can input the details:

Given the nature of the forum and the topics that we receive here, it’s difficult to pick up and track all bugs/feature requests so your best option is to raise those directly on our issue tracker.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.