dromara / dromara/forest

1.6.4返回ForestResponse默认会开启stream模式,导致读取失败

Open
#226 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.9k
Forks
241
PR merge metrics
No merged PRs in 30d

Description

如题,
```
@Get(url = "\${0}", decoder = ForestJacksonConverter::class, dataType = "json")
@BodyType(type = "json", encoder = ForestJacksonConverter::class)
@Success(condition = CommonCondition::class)
@HttpClient
fun get(url: String, @JSONBody body: B, @Header headers: Map): ForestResponse
```
get之后再用TypeReference读取时,会默认处理成stream。

1.5.36正常

com.dtflys.forest.exceptions.ForestHandlerException: com.dtflys.forest.exceptions.ForestHandlerException: com.dtflys.forest.exceptions.ForestConvertException: [Forest] json converter: 'ForestJacksonConverter' error: Unrecognized token 'stream': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 8]
at com.dtflys.forest.handler.ResultHandler.getResult(ResultHandler.java:222)
at com.dtflys.forest.reflection.MethodLifeCycleHandler.handleResultType(MethodLifeCycleHandler.java:129)
at com.dtflys.forest.reflection.MethodLifeCycleHandler.handleSyncWithException(MethodLifeCycleHandler.java:78)
at com.dtflys.forest.reflection.MethodLifeCycleHandler.handleSync(MethodLifeCycleHandler.java:62)
at com.dtflys.forest.backend.ResponseHandler.handleSync(ResponseHandler.java:39)
at com.dtflys.forest.backend.httpclient.response.HttpclientResponseHandler.handleSync(HttpclientResponseHandler.java:29)
at com.dtflys.forest.backend.httpclient.request.SyncHttpclientRequestSender.sendRequest(SyncHttpclientRequestSender.java:133)
at com.dtflys.forest.backend.httpclient.executor.HttpclientExecutor.execute(HttpclientExecutor.java:120)
at com.dtflys.forest.http.ForestRequest.execute(ForestRequest.java:5094)
at com.dtflys.forest.reflection.ForestMethod.invoke(ForestMethod.java:1521)
at com.dtflys.forest.proxy.InterfaceProxyHandler.invoke(InterfaceProxyHandler.java:236)

看源码,似乎这里少写了个return false;

![Image](https://github.com/user-attachments/assets/701a5308-87d4-4f9a-9180-c49bbfa21bb5)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.