Search code examples
javaandroidretrofit2

How to properly handle a redirect as a response in retrofit2


I'm working with an API which returns a 308 on successful creation of a resource with a POST request? How do I handle this best with retrofit2?

Or should the API not return a 308?


Solution

  • inside onResponse

    if(response.code() == 308)
    {
        //created done
    }
     else 
    {
        //not done
    }