¿Cómo cambiar el cuerpo en OkHttp Response?
Estoy usando la modificación. Para captar la respuesta estoy usando Interceptor:
OkHttpClient okHttpClient = new OkHttpClient();
okHttpClient.interceptors().add(myinterceptor);
Aquí hay un código de interceptor:
new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Response response = chain.proceed(request);
if (path.equals("/user")){
String stringJson = response.body().string();
JSONObject jsonObject = new JSONObject(stringJson);
jsonObject.put("key",1);
//here I need to set this new json to response and then return this response
¿Cómo cambiar el cuerpo en OkHttp Response?