|
zhchyu999Sep 16, 2018 via Android
1
okhttp 有个拦截器
|
|
saximoerSep 16, 2018
2
ohhttp 有一个 Interceptor 接口
实现这个接口就 实现了拦截器的功能 然后记得把这个拦截器加入 okhttp 的声明中就可以了 |
|
hongchSep 16, 2018 via iPhone
3
intercept 可以看一下 okhttp 源码 interceptchain 允许加入两个 intercept 分别是请求前和请求后
|
|
4
|
|
5
|
|
6
|
|
saximoerSep 17, 2018
7
|
|
wsxyeahSep 17, 2018 via iPhone
8
interceptor 里肯定不能直接拿到 retrofit 里的 field 啊,只能拿到 request body,可以从 request body 里取出字段再操作
|
|
9
@wsxyeah 嗯嗯,今天试试,谢谢
|
|
10
@saximoer 谢谢,我去看看
|
|
hongchSep 17, 2018
11
- - @nextdiscover 当然是拿 requestbody 如果是 get 请求就从 url 里拿
|
|
zhchyu999Sep 17, 2018
12
印象中好像是改不了,得 new 一个新的
|