UnKnown OkHttp IllegalStateException Error
I’ve recently encountered the IllegalStateException with regard to OkHttp (possibly on
DELETE request) which looks like this:
java.lang.IllegalStateException: Cannot stream a request body without chunked encoding or a known content length! at com.squareup.okhttp.internal.http.HttpTransport.createRequestBody(HttpTransport.java:68) at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:254) at com.squareup.okhttp.Call.getResponse(Call.java:198) at com.squareup.okhttp.Call.access$200(Call.java:36) at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:143) at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)
The REAL problem which gives me an headache is that I cannot replicate this exception by myself; sometimes it happens, sometimes not. f..
I’ve spent some time searching it on Google and found out several posts and issues and stackoverflow but still I cannot find the real cause of it. Or it seems like the issue is already resolved at least in OkHttp 2.0.0 version..
Hmmm. I’ll update this post when I find out something new.