File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ The only thing we need to do is defining the interface.
2929 <dependency >
3030 <groupId >com.github.dadiyang</groupId >
3131 <artifactId >http-api-invoker</artifactId >
32- <version >1.1.6 </version >
32+ <version >1.1.7 </version >
3333 </dependency >
3434```
3535
@@ -174,6 +174,25 @@ City city = cityServiceWithResponseProcessor.getCity(id);
174174
175175or in Spring scenario, register a RequestPreprocessor Bean.
176176
177+ Usually, an HTTP api would response a ResultBean formed with code/msg/data fields, like:
178+
179+ ``` json
180+ {
181+ "code" : 0 ,
182+ "data" : {
183+ "name" : " Hello"
184+ },
185+ "msg or message" : " xx"
186+ }
187+ ```
188+
189+ We provided a ` ResultBeanResponseProcessor ` for this scenario.
190+
191+ It will check the code specify by @ExpectedCode annotation or 0 by default.
192+
193+ If the code in response body is not equals to the expected one, an IllegalStateException will be thrown.
194+
195+ If they are equal, the data field will be parse to return value, unless the method do not need it or its return type is a ResultBean.
177196
178197# CORE ANNOTATION
179198
Original file line number Diff line number Diff line change 3131 <dependency >
3232 <groupId >com.github.dadiyang</groupId >
3333 <artifactId >http-api-invoker</artifactId >
34- <version >1.1.6 </version >
34+ <version >1.1.7 </version >
3535 </dependency >
3636```
3737
Original file line number Diff line number Diff line change 66
77 <groupId >com.github.dadiyang</groupId >
88 <artifactId >http-api-invoker</artifactId >
9- <version >1.1.6 </version >
9+ <version >1.1.7 </version >
1010 <packaging >jar</packaging >
1111 <parent >
1212 <groupId >org.sonatype.oss</groupId >
You can’t perform that action at this time.
0 commit comments