我知道可以从单个 Postman 请求生成代码片段,但我找不到整个集合的类似功能。
我还知道有类似的工具newman https://www.npmjs.com/package/newman用于运行 Postman Collection 2.1 json 格式的导出集合。
但具体来说,我正在寻找的是一个生成的工具bash
来自集合或 Postman Collection 2.1 json 格式的导出集合的代码。这样,我不使用 Postman 的同事就可以复制 API 请求。
Postman 中是否提供此选项,而我只是缺少它,或者是否有任何工具可以执行此操作?
我结束了使用邮递员SDK https://github.com/postmanlabs/postman-collection and 邮递员代码生成 https://github.com/postmanlabs/postman-code-generators#postman-code-generators-从我从 Postman 导出的 Postman Collections 创建代码片段。
不太确定为什么 Postman 尚未提供此功能,但我制作了一个简单的 CLI 工具来实现此功能:https://github.com/arashout/postman-collection-gen https://github.com/arashout/postman-collection-gen
# cURL request generation
node main.js -c example_collection.json
# curl --location --request GET 'https://v7rr12wbr7.execute-api.us-west-2.amazonaws.com/prod/courses?c0=PHYS153&c1=APSC160&c2=CHEM154&version_key=1.2'
# curl --location --request GET 'https://v7rr12wbr7.execute-api.us-west-2.amazonaws.com/prod/courses?c0=PHYS153'
# How to generate other languages:
node main.js -c example_collection.json -l shell,httpie
node main.js -c example_collection.json -l Swift,URLSession
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)