英文:
How to retrieve body form-data in key value pair and use it in postman test script
问题
I tried the following but did not work:
尝试了以下方法,但未成功:
pm.request.body.data
pm.request.data
英文:
I tried the following but didnot work
pm.request.body.data
pm.request.data
答案1
得分: 1
访问这种格式
pm.request.body.formdata.get("name")
pm.request.body.formdata.get("last_name")
pm.request.body.formdata.get("other_name")
[文档在这里](https://www.postmanlabs.com/postman-collection/RequestBody.html)
formdata:PropertyList.
此请求的表单数据参数存储在此字段中。
类型:PropertyList.
[![在这里输入图片描述][1]][1]
在 `Tests` 选项卡中的用法。
[![在这里输入图片描述][2]][2]
[1]: https://i.stack.imgur.com/8S8K1.png
[2]: https://i.stack.imgur.com/ppMS1.png
英文:
Access this format
pm.request.body.formdata.get("name")
pm.request.body.formdata.get("last_name")
pm.request.body.formdata.get("other_name")
Documentation in here
formdata :PropertyList.<FormParam>
Form data parameters for this request are held in this field.
Type:
PropertyList.<FormParam>
Usage in Tests
tab.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论