我想在Okhttp中更改RequestBody,RequestBody的方法是POST表单。
但是,我不知道如何将RequestBody更改为表单或地图。(以下是// TODO)
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);
}
});