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
But what if I want to use the internal header builder addUnsafeNonAscii method? There isn't any shortcut for that.
The workaround is something like:
OkHttpClient.Builder()
.addInterceptor { chain ->
chain.proceed(
chain.request()
.newBuilder()
//We need to use headers already in the request.
.headers(chain.request().headers.newBuilder().apply {
addUnsafeNonAscii(X, Y)
}.build())
.build()
)
}
It would be easy to add a new addUnsafeNonAscii method to Request.Builder that will use the internal header builder's addUnsafeNonAscii.
The text was updated successfully, but these errors were encountered:
I think it's the right call, technically possible but not a suggestion on the easy path. Since it's possible but more verbose, I'm going to close this.
When trying to add new headers inside an interceptor, I usually do the following:
But what if I want to use the internal header builder
addUnsafeNonAscii
method? There isn't any shortcut for that.The workaround is something like:
It would be easy to add a new
addUnsafeNonAscii
method toRequest.Builder
that will use the internal header builder'saddUnsafeNonAscii
.The text was updated successfully, but these errors were encountered: