Search code examples
postman

Postman - How to see request with headers and body data with variables substituted


I am using the Postman Chrome plugin to invoke HTTP requests for software testing. I use the Environments feature with Environment and Global Variables to substitute variables in my requests headers and body.

The variable substitution is working correctly (I can tell as the responses from the HTTP Server indicate that).

However, I would like to be able to see the Request Header and Body values AFTER the variables have been substituted. How can I do that?


Solution

  • Update 2018-12-12 - Chrome App v Chrome Plugin - Most recent updates at top

    With the deprecation of the Postman Chrome App, assuming that you are now using the Postman Native App, the options are now:

    1. Hover over variables with mouse
    2. Generate "Code" button/link
    3. Postman Console

    See below for full details on each option.

    Personally, I still go for 2) Generate "Code" button/link as it allows me to see the variables without actually having to send.

    Demo Request Demo Request

    Demo Environment Demo Environment

    1) Hover over variables with mouse Hover over variables with mouse

    2) Generate "Code" button/link Generate "Code" button/link

    3) Postman Console enter image description here

    Update: 2016-06-03

    Whilst the method described above does work, in practice, I now normally use the "Generate Code" link on the Postman Request screen. The generated code, no matter what code language you choose, contains the substituted variables. Hitting the "Generate Code" link is just faster, additionally, you can see the substituted variables without actually making the request.

    Original Answer below

    To see the substituted variables in the Headers and Body, you need to use Chrome Developer tools. To enable Chrome Developer Tools from within Postman do the following, as per http://blog.getpostman.com/2015/06/13/debugging-postman-requests/.

    I have copied the instructions from the link above in case the link gets broken in the future:

    1. Type chrome://flags inside your Chrome URL window

    2. Search for “packed” or try to find the “Enable debugging for packed apps”

    3. Enable the setting

    4. Restart Chrome

    You can access the Developer Tools window by right clicking anywhere inside Postman and selecting “inspect element”. You can also go to chrome://inspect/#apps and then click “inspect” just below requester.html under the Postman heading.

    Once enabled, you can use the Network Tools tab for even more information on your requests or the console while writing test scripts. If something goes wrong with your test scripts, it’ll show up here.