在 POST 有效负载中使用环境变量 [英] Using environment variables in POST payload

查看:26
本文介绍了在 POST 有效负载中使用环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Can I use environment variables set in a previous test in the payload I am posting?

eg.

POST /list

{
    "some_key": environment.saved_value
}

解决方案

Yes, you can do that. You send it up like this

{ 
    "some_key" : "{{environment_variable_name}}"
}

So, if in your previous test you had set it with something like

postman.setEnvironmentVariable("id","some_value")

You can use it in your POST with

{ 
"some_key" : "{{id}}" 
}

Hopefully, that answers your question

这篇关于在 POST 有效负载中使用环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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