-
Notifications
You must be signed in to change notification settings - Fork 754
WHen POST with body, I get java.lang.IllegalStateException: Cannot set request property after connection is made #198
Description
I am using a fork of Volley, so unfortunately my Volley is 'tainted', but when merging in master of google/volley (my fork was forked from circa 1.0.0), any time my app does a POST/PUT, I receive exceptions whenever I provide a POST body, and the request fails. The error is:
E/Volley: [311] NetworkDispatcher.processRequest: Unhandled exception java.lang.IllegalStateException: Cannot set request property after connection is made
java.lang.IllegalStateException: Cannot set request property after connection is made
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.setRequestProperty(HttpURLConnectionImpl.java:526)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.setRequestProperty(DelegatingHttpsURLConnection.java:258)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.setRequestProperty(HttpsURLConnectionImpl.java)
at com.android.volley.toolbox.HurlStack$override.executeRequest(HurlStack.java:95)
at com.android.volley.toolbox.HurlStack$override.access$dispatch(HurlStack.java)
at com.android.volley.toolbox.HurlStack.executeRequest(HurlStack.java:75)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:123)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
I'd have to guess that it has to do with HurlStack#addBody and HurlStack#executeRequest, either about putting that HEADER_CONTENT_TYPE in addBody, or the fact that executeRequest uses setRequestProperty after addBody is called.
I also am using my own JSON Request class which uses a pure Kotlin JSON library. I'd appreciate any way you could help me track down this issue. I trust that you wouldn't release a version that can't POST anything... but I see there are some commits since your last release. I could point you to my fork (or you could just go find it), but in this case it's not even hitting any of my changes.