OpenFeign/feign

feign-kotlin: Decoder type returns "Object" when method is suspending

Open

#2,019 建立於 2023年4月23日

在 GitHub 查看
 (6 留言) (1 反應) (0 負責人)Java (1,911 fork)batch import
help wantedkotlinneeds info

倉庫指標

Star
 (9,070 star)
PR 合併指標
 (平均合併 2天 17小時) (30 天內合併 71 個 PR)

描述

Currently using feign-kotlin 12.3 and kotlin 1.8.10 while attempting to use a custom decoder. When my method in the the TestClient is suspending type is printed out as "java.lang.Object" however, when not using suspend it returns the proper type of TestObject. This is currently preventing me from being able to get the proper serializer

Client Snippet:

public interface TestClient  {
    @RequestLine("GET /{uuid}")
    public suspend fun testGet(@Param("uuid") uuid: UUID): TestObject
}

Decoder snippet:

public class CustomDecoder: Decoder {
    override fun decode(response: Response, type: Type): Any? {
        if (response.status() != 404 && response.status() != 204) {
                ...
                println(type)
               ...
            }
        } else {
           ...
        }
    }
}

貢獻者指南