| | |
| | | import okhttp3.RequestBody; |
| | | import okhttp3.Response; |
| | | import okhttp3.ResponseBody; |
| | | import okhttp3.logging.HttpLoggingInterceptor; |
| | | import okio.Buffer; |
| | | import retrofit2.Retrofit; |
| | | import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; |
| | |
| | | } |
| | | }); |
| | | |
| | | //添加一个log拦截器,打印所有的log |
| | | HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(); |
| | | //可以设置请求过滤的水平,body,basic,headers |
| | | httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); |
| | | builder.addInterceptor(httpLoggingInterceptor); |
| | | Retrofit.Builder builder1 = new Retrofit.Builder() |
| | | .client(builder.build()) // 配置监听请求 |
| | | .addConverterFactory(GsonConverterFactory.create()) // 请求结果转换(当前为GSON) |