浏览器中:
Request URL: http://192.168.11.193:8083/api/xxx/image/upload/true?type=1
POST /api/intellif/image/upload/true?type=1 HTTP/1.1
Host: 192.168.11.193:8083
Connection: keep-alive
Content-Length: 6742
Pragma: no-cache
Cache-Control: no-cache
Authorization: Bearer 147e9f25-3fb1-42fb-bc05-21b2e5c8b501
Origin: http://192.168.11.193:8066
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarya9MF0hb2gtA3RQ0K
Accept: */*
Referer: http://192.168.11.193:8066/app/userManagement/newStudentsManagement
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7
Request Payload:
------WebKitFormBoundarya9MF0hb2gtA3RQ0K
Content-Disposition: form-data; name="file"; filename="2018-02-27-14-08-56-478_format_f.jpg"
Content-Type: image/jpeg
------WebKitFormBoundarya9MF0hb2gtA3RQ0K--
```java
java.lang.IllegalArgumentException: MIME type may not contain reserved characters
at org.apache.http.util.Args.check(Args.java:36)
at org.apache.http.entity.ContentType.create(ContentType.java:227)
at org.apache.http.entity.ContentType.create(ContentType.java:239)
at org.apache.http.entity.mime.content.FileBody.<init>(FileBody.java:85)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$ViewableFileBody.<init>
(HTTPHC4Impl.java:1240)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sendPostData(HTTPHC4Impl.java:1313)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.java:629)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:450)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1189)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1178)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:490)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250)
at java.lang.Thread.run(Unknown Source)
1
2DaYe 2018-05-16 13:15:54 +08:00
你把 head 写到 parameter 里了
|
2
wsds OP @2DaYe
Request Payload: ------WebKitFormBoundarya9MF0hb2gtA3RQ0K Content-Disposition: form-data; name="file"; filename="2018-02-27-14-08-56-478_format_f.jpg" Content-Type: image/jpeg ------WebKitFormBoundarya9MF0hb2gtA3RQ0K-- |
3
mypchas6fans 2018-05-16 14:18:24 +08:00
仅从这个 exception 看,我怀疑是最后一张图 File Upload 里面,MIME 类型应该是 image/png
|
4
mypchas6fans 2018-05-16 14:23:37 +08:00
说错了,是 image/jpeg。并且参数名称那里应该是“ file ”。
Parameters 这个 tab 里的 3 行参数可能都不需要 |
5
wsds OP @mypchas6fans
改了,报错不一样了 {"timestamp":1526452878375,"status":500,"error":"Internal Server Error","exception":"java.lang.RuntimeException","message":"java.lang.RuntimeException: java.io.IOException: Missing initial multi part boundary","path":"/api/intellif/image/upload/true"} |
6
mypchas6fans 2018-05-16 15:28:34 +08:00
看看结果树里面请求的内容吧,如果确实没有 boundary,把那个 use multipart/for-data for post 勾掉,然后自己加一个 http header:
名称 Content-Type 值 multipart/form-data; boundary=----WebKitFormBoundarya9MF0hb2gtA3RQ0K |
7
glacer 2018-05-16 19:19:03 +08:00
multipart 上传文件
|