我是Retrofit的新手,我正在将图像上传到服务器。 服务器返回403错误,但是在onFailure回调中,我得到了java.io.EOFException。这是应该起作用的方式吗?
--> POST https://api.platerecognizer.com/v1/plate-reader
2019-10-10 19:01:09.038 11446-11514/c D/OkHttp: Content-Type: multipart/form-data; boundary=16e8662a-3277-4638-882e-97e1020db9d4
2019-10-10 19:01:09.039 11446-11514/c D/OkHttp: Content-Length: 5190
2019-10-10 19:01:09.047 11446-11514/c D/OkHttp: --16e8662a-3277-4638-882e-97e1020db9d4
2019-10-10 19:01:09.047 11446-11514/c D/OkHttp: Content-Disposition: form-data; name="upload"; filename="pic1.jpg"
2019-10-10 19:01:09.047 11446-11514/c D/OkHttp: Content-Type: image/jpeg
2019-10-10 19:01:09.047 11446-11514/c D/OkHttp: Content-Length: 4988
2019-10-10 19:01:09.048 11446-11514/c D/OkHttp: ������JFIF����������������C��.....
2019-10-10 19:01:09.048 11446-11514/c D/OkHttp: --16e8662a-3277-4638-882e-97e1020db9d4--
2019-10-10 19:01:09.048 11446-11514/c D/OkHttp: --> END POST (5190-byte body)
2019-10-10 19:01:09.633 11446-11514/c D/OkHttp: <-- 403 Forbidden https://api.platerecognizer.com/v1/plate-reader (584ms)
2019-10-10 19:01:09.633 11446-11514/c D/OkHttp: Server: nginx/1.14.0 (Ubuntu)
2019-10-10 19:01:09.633 11446-11514/c D/OkHttp: Date: Thu, 10 Oct 2019 16:01:11 GMT
2019-10-10 19:01:09.634 11446-11514/c D/OkHttp: Content-Type: application/json
2019-10-10 19:01:09.634 11446-11514/c D/OkHttp: Transfer-Encoding: chunked
2019-10-10 19:01:09.634 11446-11514/c D/OkHttp: Connection: keep-alive
2019-10-10 19:01:09.634 11446-11514/c D/OkHttp: Vary: Accept, Cookie
2019-10-10 19:01:09.634 11446-11514/c D/OkHttp: X-Frame-Options: SAMEORIGIN
2019-10-10 19:01:09.634 11446-11514/c D/OkHttp: Allow: POST, OPTIONS
2019-10-10 19:01:09.638 11446-11446/c W/System.err: java.io.EOFException
2019-10-10 19:01:09.638 11446-11446/c W/System.err: at okio.RealBufferedSource.require(RealBufferedSource.java:65)
2019-10-10 19:01:09.638 11446-11446/c W/System.err: at okio.RealBufferedSource.readHexadecimalUnsignedLong(RealBufferedSource.java:307)
2019-10-10 19:01:09.638 11446-11446/c W/System.err: at okhttp3.internal.http1.Http1ExchangeCodec$ChunkedSource.readChunkSize(Http1ExchangeCodec.java:488)
2019-10-10 19:01:09.638 11446-11446/c W/System.err: at okhttp3.internal.http1.Http1ExchangeCodec$ChunkedSource.read(Http1ExchangeCodec.java:467)
2019-10-10 19:01:09.638 11446-11446/c W/System.err: at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.java:286)
2019-10-10 19:01:09.639 11446-11446/c W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:51)
2019-10-10 19:01:09.639 11446-11446/c W/System.err: at okio.RealBufferedSource.exhausted(RealBufferedSource.java:61)
2019-10-10 19:01:09.639 11446-11446/c W/System.err: at okio.InflaterSource.refill(InflaterSource.java:102)
2019-10-10 19:01:09.639 11446-11446/c W/System.err: at okio.InflaterSource.read(InflaterSource.java:62)
2019-10-10 19:01:09.639 11446-11446/c W/System.err: at okio.GzipSource.read(GzipSource.java:80)
2019-10-10 19:01:09.639 11446-11446/c W/System.err: at okio.RealBufferedSource.request(RealBufferedSource.java:72)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:253)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:172)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
2019-10-10 19:01:09.640 11446-11490/c I/TestRunner: finished: testUploadImage(Tests.ServerRequestsTest)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2019-10-10 19:01:09.640 11446-11446/c W/System.err: at java.lang.Thread.run(Thread.java:764)
2019-10-10 19:01:09.640 11446-11446/c D/failure: message = null
2019-10-10 19:01:09.640 11446-11446/c D/failure: cause = null