Postman 获取环境名称作为变量 [英] Postman get the environment name as a variable

查看:70
本文介绍了Postman 获取环境名称作为变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在 Postman 中获取环境名称作为环境变量.

I would like to know if it's possible to get the environment name as an environment variable in Postman.

目前我自己在每个环境的环境变量中手动设置它,但它可以从某种应用程序变量中检索,这会很棒.

Currently I'm setting it myself manually in the environment variables for each environment but it that can be retrieved from some sort of application variable that would be great.

我在文档中找不到任何内容.

I can't find anything in the docs.

推荐答案

这应该为您提供当前选择的环境的名称:

This should give you the name of the environment that's currently selected:

pm.environment.set("envName", pm.environment.name)

这篇关于Postman 获取环境名称作为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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