Browse Source

更新文档

drake 4 years ago
parent
commit
043ce33322
2 changed files with 12 additions and 7 deletions
  1. 5 7
      docs/converter.md
  2. 7 0
      docs/interceptor.md

+ 5 - 7
docs/converter.md

@@ -3,7 +3,11 @@
 Net使用泛型指定返回数据类型
 
 ```kotlin
-
+scopeNetLife {
+    val userList = Get<List<UserModel>>("list-data") {
+        converter = SerializationConverter()
+    }.await()
+}
 ```
 
 ## 默认支持类型
@@ -35,12 +39,6 @@ Demo截图预览
 一般业务我们可以直接继承[JSONConverter](https://github.com/liangjingkanji/Net/blob/master/net/src/main/java/com/drake/net/convert/JSONConvert.kt)
 使用自己的JSON解析器解析数据, 自定义需求可以直接实现[NetConverter](https://github.com/liangjingkanji/Net/blob/master/net/src/main/java/com/drake/net/convert/NetConverter.kt)
 
-添加依赖
-
-```kotlin
-
-```
-
 === "Kotlin-Serialization"
 
     [Kotlin-Serialization GitHub](https://github.com/Kotlin/kotlinx.serialization)

+ 7 - 0
docs/interceptor.md

@@ -16,6 +16,13 @@ class App : Application() {
 }
 ```
 
+在拦截器中可以使用以下函数复制请求/响应体
+
+| 函数 | 描述 |
+|-|-|
+| peekString | 可以复制截取RequestBody/ResponseBody, 且返回String |
+| logString | 等效于上面函数, 但是Response仅支持文本/JSON, Request仅支持FormBody |
+
 ## 请求拦截器
 
 RequestInterceptor属于轻量级的请求拦截器, 在每次请求的时候该拦截器都会被触发. 一般用于添加全局的参数和请求头