When an OkHttp interceptor modifies request headers, the modified headers are present in okhttp3.Response.request but are not preserved in retrofit2.Response.raw().request.
Steps to Reproduce:
- Create an interceptor that modifies request headers:
updatedReq = originalReq.newBuilder().addHeader("X-Custom-Header", "some-value").build()
httpResponse = chain.proceed(updatedReq)
- okhttp3.Response.request has the header ✅
- retrofit2.Response.raw().request.header("X-Custom-Header") returns null ❌
Expected Behavior:
retrofit2.Response.raw().request should contain the same headers as okhttp3.Response.request (the modified request that was actually sent).
Actual Behavior:
retrofit2.Response.raw().request contains the original request headers (before interceptor modifications).
Impact:
Custom headers added by interceptors cannot be extracted from retrofit2.Response.raw().request, forcing workarounds like adding values to response headers.