Comments (9)
Hey @DE-DuyTran
Do you still experience this issue?
If so, could you provide details requested by @cortinico in the message above?
from chucker.
@cortinico @vbuberen
Sorry for very late reply...
This is my answer.
-
What does can't upload file via multipart?
I upload Image file (JPEG) to attach with json body. -
Are you getting a HTTP error code?
What i receive from LogCat
"com.androidnetworking.error.ANError: java.net.ProtocolException: unexpected end of stream"
"java.net.ProtocolException: unexpected end of stream" -
Do you have any stacktrace to share?
handlerError:170, BaseDisposable (xxxx.model.base)
access$handlerError:40, BaseDisposable (xxxx.model.base)
accept:92, BaseDisposable$startWithoutCheckNetwork$1 (xxxx.model.base)
accept:40, BaseDisposable$startWithoutCheckNetwork$1 (xxxx.model.base)
onError:114, ObservableDoOnEach$DoOnEachObserver (io.reactivex.internal.operators.observable)
checkTerminated:276, ObservableObserveOn$ObserveOnObserver (io.reactivex.internal.operators.observable)
drainNormal:172, ObservableObserveOn$ObserveOnObserver (io.reactivex.internal.operators.observable)
run:252, ObservableObserveOn$ObserveOnObserver (io.reactivex.internal.operators.observable)
run:119, HandlerScheduler$ScheduledRunnable (io.reactivex.android.schedulers)
handleCallback:873, Handler (android.os)
dispatchMessage:99, Handler (android.os)
loop:201, Looper (android.os)
main:6806, ActivityThread (android.app)
invoke:-1, Method (java.lang.reflect)
run:547, RuntimeInit$MethodAndArgsCaller (com.android.internal.os)
main:873, ZygoteInit (com.android.internal.os) -
Is the app crashing?
It's no crashing. -
Is this issue happening only for multipart requests?
I'm not yet test for other case.
from chucker.
Thanks a lot for such a detailed input.
I searched through issues in Fast Android Networking and found an issue, which looks quite similar to what you described: amitshekhariitbhu/Fast-Android-Networking#464
If it happens to be the same issue, it seems that it is not Chucker, but Fast Android Networking.
from chucker.
I guess, we can close it, since no other reports here.
from chucker.
HI @vbuberen
Similar with ktor(1.5.0/1.5.2) and multipart upload
with chucker(3.4.0):
I/System.out: File exists: IMG_20210329_084101.jpg, size=31660
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] REQUEST: https://*.*/blabla
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] METHOD: HttpMethod(value=PUT)
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] COMMON HEADERS
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Accept: application/json
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Accept-Charset: UTF-8
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Authorization: blabla
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Cache-Control: private
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] CONTENT HEADERS
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Content-Length: 32085
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Content-Type: multipart/form-data; boundary=-681f0d6a310571652db4fcd412f01206-38c3e46b45ddb43479b39dfc-30c76d864e3
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] BODY Content-Type: multipart/form-data; boundary=-681f0d6a310571652db4fcd412f01206-38c3e46b45ddb43479b39dfc-30c76d864e3
I/i.k.c.HttpClient.log: [OkHttp https://*.*/...] BODY START
I/i.k.c.HttpClient.log: [OkHttp https://*.*/...] [request body omitted]
I/i.k.c.HttpClient.log: [OkHttp https://*.*/...] BODY END
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-3] REQUEST https://*.*/blabla failed with exception: java.net.ProtocolException: unexpected end of stream
Caused by: java.net.ProtocolException: unexpected end of stream
at okhttp3.internal.connection.Exchange$RequestBodySink.close(Exchange.kt:239)
at okio.RealBufferedSink.close(RealBufferedSink.kt:268)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:60)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:82)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept(ChuckerInterceptor.kt:114)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:197)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:502)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
without chucker ok:
I/System.out: File exists: IMG_20210329_084101.jpg, size=31660
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] REQUEST: https://*.*/blabla
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] METHOD: HttpMethod(value=PUT)
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] COMMON HEADERS
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Accept: application/json
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Accept-Charset: UTF-8
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Authorization: blabla
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Cache-Control: private
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] CONTENT HEADERS
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Content-Length: 32085
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] -> Content-Type: multipart/form-data; boundary=6538ee3e2b1702c55849d34-6c66f14c702565c15406a4a4-7b253755310821926b054
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] BODY Content-Type: multipart/form-data; boundary=6538ee3e2b1702c55849d34-6c66f14c702565c15406a4a4-7b253755310821926b054
I/i.k.c.HttpClient.log: [OkHttp https://*.*/...] BODY START
I/i.k.c.HttpClient.log: [OkHttp https://*.*/...] [request body omitted]
I/i.k.c.HttpClient.log: [OkHttp https://*.*/...] BODY END
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] RESPONSE: 200 OK
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] METHOD: HttpMethod(value=PUT)
I/i.k.c.HttpClient.log: [DefaultDispatcher-worker-1] FROM: https://*.*/blabla
method for upload:
suspend fun attachFile(
context: Context,
uri: Uri,
fileName: String,
fileSizeByte: Long
) {
client.request<HttpResponse> {
apiUrl("blabla")
method = HttpMethod.Put
body = MultiPartFormDataContent(
formData {
appendInput(
key = "encode-base64-scan",
headers = Headers.build {
append(HttpHeaders.ContentLength, fileSizeByte)
append(HttpHeaders.ContentDisposition, "filename=${fileName}")
},
size = fileSizeByte
) {
buildPacket {
context.contentResolver.openInputStream(uri)!!.use {
writeFully(it.readBytes())
}
}
}
}
)
}
}
from chucker.
Hey @DE-DuyTran
Thanks for the report. Can you please provide more context?
- What does
can't upload file via multipart
? - Are you getting a HTTP error code?
- Do you have any stacktrace to share?
- Is the app crashing?
- Is this issue happening only for multipart requests?
Ideally if you could provide also a sample project where we can reproduce the issue, would be awesome.
from chucker.
HI @vbuberen
Similar with ktor(1.5.0/1.5.2) and multipart upload
Please open a new issue.
Also I'm unsure how KTor is relevant here as Chucker works only with OkHTTP
from chucker.
Also I'm unsure how KTor is relevant here as Chucker works only with OkHTTP
You can install OkHttp as an underlying client.
from chucker.
You can install OkHttp as an underlying client.
TIL :O
from chucker.
Related Issues (20)
- Chucker working fine in react native debug build. how to enable in release build? HOT 3
- With notifications disabled, Chucker will still ask for notification permission when launching the activity HOT 5
- body is empty in the Request Body even though the log shows the actual request body (see screenshot) HOT 3
- Chucker not working in React native latest version
- Control what to show/ hide in request/ response bodies HOT 3
- Allow tracking of all network calls HOT 3
- IllegalStateException when open single API request information on release build. HOT 6
- The large JSON data is corrupted. I cannot see or export large JSON file (3.2mb)
- Aaa
- chucker/4.0.0 build faild on jitpack HOT 2
- Can not force ltr in RTL languages HOT 1
- Chucker not working on some devices but is working on others
- Localization HOT 1
- Toolbar subtitle (app name) gets truncated on device OnePlus7 Pro (OS 12)
- Duplicate class com.chuckerteam.chucker.api.Chucker found in modules jetified-library-4.0.0-runtime HOT 5
- 7016
- Ignore domains and paths from interceptor HOT 7
- Method skipPaths on builder does not work as expected HOT 1
- Global Interceptor adding HOT 1
- Support for `ktor` networking library using in `android` and `kmp` projects. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chucker.