2

I've been using Volley for a while but today I'm facing a very weird problem. I'm making a Post JsonRequest successfully, but if I try again the request to the same service it fails, if I try once again it's successful and so on.

If the request is successful and I restart the app, the next request will still be successful, then it fails, it succeed and so on.

The same happens with a StringRequest.

What happens is that in HurlStack class I fall in this if:

if (responseCode == -1) {            
// -1 is returned by getResponseCode() if the response code could not be retrieved.            
// Signal to the caller that something was wrong with the connection.

 throw new IOException("Could not retrieve response code from HttpUrlConnection.");

 }

but I know that even in this case the request was correctly posted to the server (I checked the logs).

Nagama Inamdar
  • 2,851
  • 22
  • 39
  • 48
A._
  • 23
  • 6
  • I'm also running into this problem. I'd love to know if you found what the issue was. – user3331142 Mar 26 '16 at 14:57
  • I also have this issue, but only if I pass in a `HurlStack` to `Volley#newRequestQueue()`. If I pass just the `Context`, I have no issue. – pathfinderelite May 23 '16 at 19:46
  • The solution [here](http://stackoverflow.com/questions/1440957/httpurlconnection-getresponsecode-returns-1-on-second-invocation) solved my problem. – pathfinderelite May 24 '16 at 12:57

0 Answers0