我正在尝试将一个文件(230MB)发送到
NGinx/1.10.2
服务器配置为处理最大200MB。
我发送这样的文件:
@Multipart
@POST("api/test")
Completable test(
@PartMap Map<String, RequestBody> params,
@Part MultipartBody.Part file
);
我的日志:
--> POST https://testserver.com/api/test
Content-Type: multipart/form-data; boundary=4efbe174-e228-4dc7-aeec-d6dbe4ab4302
Content-Length: 230757873
Authorization: Bearer ...
--> END POST
<-- HTTP FAILED: javax.net.ssl.SSLException: Write error: ssl=0x76c8f32400: I/O error during system call, Connection reset by peer
30秒后。
如果我用
Postman
Retrofit version: 2.4.0
OkHttp version: 3.10.0
请求部分:
public Completable test(File file) {
Map<String, RequestBody> map = getInfo();
RequestBody body = RequestBody.create(MediaType.parse(getMimeType(file.toString())), file);
MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("file", file.getName(), body);
return retrofit.create(Api.class)
.flatMapCompletable(api -> api.test(map, fileToUpload));
}