I want to change the RequestBody in Okhttp, the RequestBody's method is POST form.
But, I don't know how to change the RequestBody to a Form or map.(Which //TODO in the follow)
httpClient.networkInterceptors().add(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
RequestBody body = original.body();
if (null != body) {
//TODO Get the form data, encrypt the value of 'data', and add a param with version/1.0
body = new EncryptRequestBody(body);
}
Request.Builder requestBuilder = original.newBuilder()
.method(original.method(), body);
Request request = requestBuilder.build();
return chain.proceed(request);
}
});