File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 5252
5353 * [ 如何传入请求头] ( #如何传入请求头 )
5454
55+ * [ 如何传入动态的请求头] ( #如何传入动态的请求头 )
56+
5557 * [ 如何重命名参数或者请求头的名称] ( #如何重命名参数或者请求头的名称 )
5658
5759 * [ 如何上传文件] ( #如何上传文件 )
@@ -1079,9 +1081,27 @@ public final class XxxApi implements IRequestApi {
10791081}
10801082```
10811083
1084+ #### 如何传入动态的请求头
1085+
1086+ * 定义一个字段,并在上面添加 `@HTTPHeader ` 注解即可
1087+
1088+ ```java
1089+ public final class XxxApi implements IRequestApi {
1090+
1091+ @NonNull
1092+ @Override
1093+ public String getApi () {
1094+ return " xxx/xxxx" ;
1095+ }
1096+
1097+ @HttpHeader
1098+ private String time;
1099+ }
1100+ ```
1101+
10821102#### 如何重命名参数或者请求头的名称
10831103
1084- * 给字段加上 ` @HttpRename ` 注解即可,则可以修改参数名的值,如果没有加上此注解,则框架默认使用字段名作为参数名
1104+ * 传入一个 HashMap 类型的字段,并在上面添加 ` @HTTPHeader ` 注解即可
10851105
10861106```java
10871107public final class XxxApi implements IRequestApi {
@@ -1092,8 +1112,8 @@ public final class XxxApi implements IRequestApi {
10921112 return " xxx/xxxx" ;
10931113 }
10941114
1095- @HttpRename ( " k " )
1096- private String keyword ;
1115+ @HTTPHeader
1116+ private HashMap< String , String > headers ;
10971117}
10981118```
10991119
You can’t perform that action at this time.
0 commit comments