I am getting java.lang.IllegalStateException
:
java.lang.IllegalStateException
: Cannot set request property after connection is made error when setRequestProperty
method is called after url.openConnection();
Here is what i am trying:
URL url = new URL("https://49.205.102.182:7070/obsplatform/api/v1/mediadevices/545b801ce37e69cc");
urlConnection = (HttpsURLConnection) url
.openConnection();
urlConnection.setRequestProperty("Content-Type","application/json");
any suggestions please? Thanks in advance.
This usually happens if you have in the debug watchers calls, such as conn.getResponseCode()
or anything that queries the request result before the request was actually issued or completed. This causes, that during debug, a request is performed by the watcher, before having properly set you request, and then it becomes invalid.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments