我收到了来自POSTMAN的请求
POST /v1/files HTTP/1.1
Postman-Token: ab620166-b3ce-c21f-0e29-97cd43111daa
Content-Type: multipart/form-data; boundary=---- WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="image1"; filename=""
Content-Type:
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="image2"; filename=""
Content-Type:
------WebKitFormBoundary7MA4YWxkTrZu0gW--
我已尝试将其转换为HTTPClient帖子
httpPost.addHeader("Content-Type", "multipart/form-data");
HttpEntity entity = MultipartEntityBuilder
.create()
.setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
.addBinaryBody("image1",new(File("/image1.jpg"))
.addBinaryBody("image2",new(File("/image2.jpg"))
.build();
我也尝试过使用bodyPart而不是addBinarybody ......
我仍然收到来自服务器的错误请求,我丢失了什么?