I'm using Robospice with Retrofit module just like in sample. I'm sending a POST request with body data.
When request returns 200, it's ok.
But when it returns for example error 403, I see it is executing 3 times! onRequestFailure callback receives the control only after the last request execution.
And log tells that loadDataFromNetwork() method from RetrofitSpiceRequest's descendant class is called 3 times too.
How can I avoid this strange behavior?
It's called "retry policy".
How can I setup a retry policy for failed requests ?
Use spiceRequest.setRetryPolicy(). By default, requests have a DefaultRetryPolicy. It will be activated when a network request fails.