You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
* @author szsoftware
*/
class ResponseCodeInterceptor(private val from: Int, private val to: Int) : Interceptor {
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val response = chain.proceed(request)
val headers = response.headers
val body = response.body
val newCode = when(val oldCode = response.code) { from -> to else -> oldCode}
return response
.newBuilder()
.code(newCode)
.headers(headers)
.body(body)
.build()
}
}
In my case I even only needed the headers, since the response body is empty (as expected).
In the responses header, in a Location "field" resides a token which was requested by a previous post request.
Due to sso mechanisms, a ridiculous 303 chain resulted in 302 at the end, what could finally not been processed by Retrofit + NetworkResponseAdapter.
The text was updated successfully, but these errors were encountered:
Thanks for reporting the issue. This seems like an extension of #23 where information about the response is lost in NetworkResponse.UnknownError. The plan is to add nullable fields to the UnknownError type containing information about the response, such as headers or the raw response itself.
I can not give you an ETA on this, unfortunately. I would be happy to accept external contributions, though.
NetworkResponseAdapter/src/main/kotlin/com/haroldadmin/cnradapter/ResponseHandler.kt
Line 37 in 76c3ae4
This is a dependent issue to:
square/okhttp#6456
Workaround: ResonseCodeInterceptor(302, 200)
In my case I even only needed the headers, since the response body is empty (as expected).
In the responses header, in a Location "field" resides a token which was requested by a previous post request.
Due to sso mechanisms, a ridiculous 303 chain resulted in 302 at the end, what could finally not been processed by Retrofit + NetworkResponseAdapter.
The text was updated successfully, but these errors were encountered: