邮递员 - 如何查看带有替换变量的标头和正文数据的请求 [英] Postman - How to see request with headers and body data with variables substituted

查看:10
本文介绍了邮递员 - 如何查看带有替换变量的标头和正文数据的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

演示环境

1) 用鼠标悬停在变量上

2) 生成代码"按钮/链接

3) 邮递员控制台

更新:2016-06-03

虽然上述方法确实有效,但实际上,我现在通常使用 Postman 请求屏幕上的生成代码"链接.生成的代码,无论您选择哪种代码语言,都包含替换变量.点击生成代码"链接更快,此外,您无需实际发出请求即可查看替换变量.

原始答案如下

要查看 Headers 和 Body 中的替换变量,您需要使用 Chrome 开发者工具.要在 Postman 中启用 Chrome 开发人员工具,请按照 http 执行以下操作://blog.getpostman.com/2015/06/13/debugging-postman-requests/.

我已经复制了上面链接中的说明,以防将来链接损坏:

  1. 在您的 Chrome URL 窗口中输入 chrome://flags

  2. 搜索打包"或尝试找到为打包应用启用调试"

  3. 启用设置

  4. 重启 Chrome

<块引用>

您可以通过右键单击任意位置来访问开发者工具"窗口在 Postman 中并选择检查元素".你也可以去chrome://inspect/#apps 然后点击下方的inspect"邮递员标题下的 requester.html.

启用后,您可以使用网络工具"选项卡获得更多信息编写测试时有关您的请求或控制台的信息脚本.如果您的测试脚本出现问题,它会显示出来在这里.

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?

解决方案

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 Environment

1) Hover over variables with mouse

2) Generate "Code" button/link

3) Postman Console

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.

这篇关于邮递员 - 如何查看带有替换变量的标头和正文数据的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆