如何在Postman中请求参数? [英] How to get to request parameters in Postman?
本文介绍了如何在Postman中请求参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为Postman编写测试,该测试通常很容易进行.但是,我现在要访问请求的某些数据,确切地说是一个查询参数.您可以通过返回字符串的"request.url"对象访问请求URL.邮递员中有一种简单的方法可以解析此URL字符串以访问查询参数?
I'm writing tests for Postman which in general works pretty easily. However, I now want to access some of the data of the request, a query parameter to be exact. You can access the request URL through the "request.url" object which returns a String. Is there an easy way in Postman to parse this URL string to access the query parameter(s)?
推荐答案
如果要提取URL编码格式的查询字符串而不进行解析.这是操作方法:
If you want to extract the query string in URL encoded format without parsing it. Here is how to do it:
pm.request.url.getQueryString() // example output: foo=1&bar=2&baz=3
这篇关于如何在Postman中请求参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文