provenance-io / explorer-service

The server side of the blockchain Explorer app. Allows for UI browsing of the blockchain.
Apache License 2.0
6 stars 3 forks source link

Feign api-client does not accept query parameters #487

Closed benarena closed 1 year ago

benarena commented 1 year ago

Summary of Bug

The feign clients in the api-client module reject calls that include query parameters because they are not included in the @RequestLine

Version

5.4.0

Steps to Reproduce

Call the client:

ExplorerClient("https://service-explorer.test.provenance.io").governanceClient.votesByAddress(address, count, page)

Response is:

feign.FeignException$MethodNotAllowed: [405 Method Not Allowed] during [GET] to [https://service-explorer.test.provenance.io/api/v3/governance/proposals] [GovernanceClient#allProposals(int,int)]: []

Solution

Fix is simply to include the query parameters in the request line, e.g.

object GovernanceRoutes {
    const val GOV_V3 = "${BaseRoutes.V3_BASE}/gov"
    const val ALL = "$GOV_V3/proposals?count={count}&page={page}"
}

@RequestLine("GET ${GovernanceRoutes.ALL}")
    fun allProposals(
        @Param("count") count: Int = 10,
        @Param("page") page: Int = 1
    ): PagedResults<GovProposalDetail>

https://github.com/provenance-io/explorer-service/blob/main/api-client/src/main/kotlin/io/provenance/explorer/client/GovernanceClient.kt


For Admin Use