使用jmeter 上传文件

1.上传图片至阿里云时参数使用的parameters ,所以http的消息头中并没有添加content-type ,如果消息头中添加了Content-Type: multipart/form-data; 或者 Content-Type: multipart/form-data; boundary=WzrMQSzpBDdhlJI8mPQTBmKxdP9BmjLN都会错误 ;

2.注意如果上传的是图片: Files Upload 中 MIME类型:image/jpeg ,如果是文件就是流的形式:application/octet-stream ;

消息头中添加:Content-Type:multipart/form-data; 错误提示:

{
"timestamp" : "20181122221933371",
"status" : 500,
"error" : "Internal Server Error",
"exception" : "java.io.IOException",
"message" : "java.io.IOException: Missing initial multi part boundary",
"path" : "/unex-pim/oss/archive/uploadFile"
}

消息头中添加:Content-Type: multipart/form-data; boundary=3NiUKdrc2jtqIcfLsyR844vUCoio9yPmq7HhR9ZA 错误提示:

{
"timestamp" : "20181122222143486",
"status" : 500,
"error" : "Internal Server Error",
"exception" : "java.io.IOException",
"message" : "java.io.IOException: Missing initial multi part boundary",
"path" : "/unex-pim/oss/archive/uploadFile"
}

原文地址:https://www.cnblogs.com/linbo3168/p/10004408.html