JMETER:multipart/form-data 请求 - 无法使用 jmeter 上传任何文件类型
JMETER: multipart/form-data request - unable to upload any file type using jmeter
Jmeter v.5.1.1 r1855137
我正在尝试使用 multipart/form-data 请求类型上传 .xlsx 文件,
但是,我遇到了不同的错误,例如:
- 多部分body超过长度限制16384;
- 流意外结束,内容可能已被另一个组件读取;
T这些是 POST 请求的参数,应该上传我们的 .xlsx 文件:
screenshot_1
Method: POST;
Use multipart/form-data checkbox: unchecked;
File Path: C:\temp00Lanes.xlsx;
Parameter Name: file;
MIME Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
- 为 .xlsx 文件类型指定了 MIME 类型值 - https://www.freeformatter.com/mime-types-list.html;
T这些是 Header 管理器 参数
screenshot_2
Content-Type: multipart/form-data; boundary=--AaB03x
注意Body数据和参数留空
screenshot_3
所以,请帮我弄清楚配置中的错误是什么使上传成功?
经过1天的努力,我找到了解决方案,现在上传成功了。
因此,使用我的问题中指定的相同配置
您唯一需要添加的是进入 HTTP 请求的“Advanced”选项卡并将“Implementation”参数设置为 Java
https://i.stack.imgur.com/GtEDz.png
从 HTTP Header 管理器中删除 Content-Type header
为 HTTP 请求采样器勾选 Use multipart/form-data
框:
以后请注意,您不必手动构建文件上传请求(以及任何其他请求),您可以使用 HTTP(S) Test Script Recorder, just make sure to copy the file to "bin" folder of your JMeter installation otherwise JMeter won't be able to properly catch the request and generate correct HTTP Request sampler, see Recording File Uploads with JMeter 记录文件上传事件以获取更多详细信息
- According to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.3 (or whatever is the latest stable version available at JMeter Downloads 页)下一个可用机会
Jmeter v.5.1.1 r1855137
我正在尝试使用 multipart/form-data 请求类型上传 .xlsx 文件, 但是,我遇到了不同的错误,例如:
- 多部分body超过长度限制16384;
- 流意外结束,内容可能已被另一个组件读取;
T这些是 POST 请求的参数,应该上传我们的 .xlsx 文件: screenshot_1
Method: POST;
Use multipart/form-data checkbox: unchecked;
File Path: C:\temp00Lanes.xlsx;
Parameter Name: file;
MIME Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
- 为 .xlsx 文件类型指定了 MIME 类型值 - https://www.freeformatter.com/mime-types-list.html;
T这些是 Header 管理器 参数 screenshot_2
Content-Type: multipart/form-data; boundary=--AaB03x
注意Body数据和参数留空 screenshot_3
所以,请帮我弄清楚配置中的错误是什么使上传成功?
经过1天的努力,我找到了解决方案,现在上传成功了。
因此,使用我的问题中指定的相同配置 您唯一需要添加的是进入 HTTP 请求的“Advanced”选项卡并将“Implementation”参数设置为 Java https://i.stack.imgur.com/GtEDz.png
从 HTTP Header 管理器中删除 Content-Type header
为 HTTP 请求采样器勾选
Use multipart/form-data
框:
以后请注意,您不必手动构建文件上传请求(以及任何其他请求),您可以使用 HTTP(S) Test Script Recorder, just make sure to copy the file to "bin" folder of your JMeter installation otherwise JMeter won't be able to properly catch the request and generate correct HTTP Request sampler, see Recording File Uploads with JMeter 记录文件上传事件以获取更多详细信息
- According to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.3 (or whatever is the latest stable version available at JMeter Downloads 页)下一个可用机会