# View and Edit Raw Request before sending

**URL:** <https://community.postman.com/t/view-and-edit-raw-request-before-sending/8280>\
**Category:** Help Hub\
**Created:** [October 10, 2019, 6:05am UTC](https://community.postman.com/t/view-and-edit-raw-request-before-sending/8280 "2019-10-10T06:05:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nona2](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@Nona2](https://community.postman.com/u/Nona2)\
**Post date:** [October 10, 2019, 6:05am UTC](https://community.postman.com/t/view-and-edit-raw-request-before-sending/8280/1 "2019-10-10T06:05:44Z")

</div>

How do I View, and maybe edit, the Raw request headers before sending the request?  
Why do I want to do this? I’m creating a few collections that use a single OAuth2 authentication token yet the server (not ours) is replacing Bearer with a non-standard tag. So I need to be able to edit to the request to change this in the Collection.

I notice that I can see the code of the request in a wide range of formats yet it isn’t including headers and values from the parent collection.

I’m use to working with Curl and HTTPie so writing HTTP requests is really not a problem for me. I just need to do what I use to do with these tools using Postman.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 10, 2019, 6:26am UTC](https://community.postman.com/t/view-and-edit-raw-request-before-sending/8280/2 "2019-10-10T06:26:48Z")

</div>

Hey @Nona2

Welcome to the Postman community!! 🚀

This is similar to a previous question asked on a different thread - If you take a look through that you will hopefully get the details you need.

> [@Setting headers for entire collection/folder](https://community.postman.com/t/setting-headers-for-entire-collection-folder/708/14):
>
> As of 7.0.9 - You should be able to now do this in your Pre-request Scripts. You can use the following syntax: pm.request.headers.add({key: 'header\_name', value: 'header\_value' }) pm.request.headers.upsert({key: 'header\_name', value: 'header\_value' }) pm.request.headers.remove('header\_name') EDIT: Fork this collection to see how it works directly in Postman: [https://www.postman.com/postman/workspace/postman-answers/collection/9215231-ef055751-7385-45b4-a6f9-91bbd1c47fa5?ctx=documentation](https://www.postman.com/postman/workspace/postman-answers/collection/9215231-ef055751-7385-45b4-a6f9-91bbd1c47fa5?ctx=documentation)

You can find a little more information about the syntax to use in the `Pre-request Scripts` here:

> **[Process data and script workflows using Postman JavaScript objects | Postman...](https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/)**
>
> Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs—faster.

---

<div class="post-metadata">

**Author:** ![Nona2](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@Nona2](https://community.postman.com/u/Nona2)\
**Post date:** [October 10, 2019, 7:13am UTC](https://community.postman.com/t/view-and-edit-raw-request-before-sending/8280/3 "2019-10-10T07:13:33Z")

</div>

Thanks Danny,

I’ve tried this and the seems to be working for my basic ping test yet it still doesn’t show the inserted headers in a Raw request or the Code view, even after running it. Nor are the headers shown in the Temporary Headers tab.  
This is what I added. First to the Collection then moved to request itself.

```auto
pm.request.headers.add({key: 'Authorization', value: 'SWSS xxxxxxxxxxxxxxxx' }) 
pm.request.headers.remove('Postman-Token')
pm.request.headers.remove('Cache-Control')

```

I noticed that it didn’t show the Postman-Token or Cache-Control headers as removed. I’ll check if they are with Wireshark later though wish this wasn’t necessary.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 10, 2019, 8:30am UTC](https://community.postman.com/t/view-and-edit-raw-request-before-sending/8280/4 "2019-10-10T08:30:19Z")

</div>

Seems to be coming through for me:

 ![43](https://us1.discourse-cdn.com/getpostman/original/3X/4/0/40bb375db070d2d535e351109c4fdda00e746ffb.png)

I’ve opened the `Postman Console` to show the `Authorization` Header being sent with the Request.

I wouldn’t expect to see the script changes in the generated `code` snippet, as that wouldn’t pick up the changes from the `Pre-request Script` and `Tests` sandbox environment.

To remove the `Postman-Token` and `Cache-Control` headers, you could just do this globally, from the `General Settings.`

 ![27](https://us1.discourse-cdn.com/getpostman/original/2X/c/c6901c8d713a61527f55796268c89cd33d31a0a5.png)

---

<div class="post-metadata">

**Author:** ![Nona2](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@Nona2](https://community.postman.com/u/Nona2)\
**Post date:** [October 10, 2019, 10:25pm UTC](https://community.postman.com/t/view-and-edit-raw-request-before-sending/8280/5 "2019-10-10T22:25:50Z")

</div>

Thanks again Danny much appreciated.
