如何在 JMeter 中将二进制文件(附件)作为请求正文发布
与在 Postman 中一样,二进制文件本身可以作为请求正文附加以执行 Post 操作,我尝试通过文件上传选项在 JMeter 中附加二进制文件。但它不起作用。输入的二进制文件不会被扣除,也不会作为请求体发送。
这是我尝试过的, 在 HTTP 请求中,我使用文件上传选项从本地附加二进制文件,方法是将 MIME 类型指定为 application/octet-stream 并将参数字段保留为空。
我在这里做错了什么?能否提供一个解决方案,说明我如何才能将二进制文件作为 JMeter 中的输入传递?
As in Postman, where the binary file itself could be attached as a request body to perform a Post operation, I am trying to attach a binary file in JMeter via File upload option. But it is not working. The input binary file is not deducted and it is not sent as a request body.
Here is what I have tried,
In the HTTP request, I used File upload option to attach the binary file from my Local by giving MIME type as application/octet-stream and by leaving Parameter field as empty.
What am I doing wrong here? Can a solution be provided on this on how else could I pass a binary file as an input in JMeter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将参数字段保留为空
- 我认为这不是有效的配置,很可能您需要指定关联的名称 HTML 输入我也会尝试勾选
使用 multipart/form-data
框展望未来,我建议即使使用 JMeter 的 HTTP(S) 测试脚本记录器,只需确保将文件复制到 JMeter 的在浏览器中执行请求之前,先创建“bin”文件夹,这样 JMeter 将能够拦截请求并正确生成 HTTP 请求采样器和 HTTP 标头管理器。如果需要,请参阅使用 JMeter 记录文件上传一文了解更多信息
更多信息:
leaving Parameter field as empty
- I don't think it's valid configuration, most probably you need to specify the name of associated HTML InputI would also try ticking
Use multipart/form-data
boxGoing forward I would recommend just recording the file upload even using JMeter's HTTP(S) Test Script Recorder, just make sure to copy the file to JMeter's "bin" folder prior to executing the request in browser, this way JMeter will be able to intercept the request and properly generate the HTTP Request sampler and HTTP Header Manager. See Recording File Uploads with JMeter article for more information if needed
More information: