I use spring cloud version 2021.0.3 also tried to use version 2021.0.4 I have FeignClient "DigitalCashTokenFeign" and I'm trying to send a request to my other service

Example:

@FeignClient(
    value = "digital-cash",
    primary = false,
)
interface DigitalCashTokenFeign {
    @GetMapping("/digital-cash/internal/api/v1/digital/token/{deviceId}")
    fun getDigitalCashToken(@PathVariable deviceId: String): ResponseEntity<String>
}

Also i tried use (@PathVariable("deviceId") deviceId: String) but nothing has changed

when calling this method i get service side error: 2023-02-16 21:29:56.360 WARN [digital-cash,faee331c0ae7e791,8389463eec20bd06] 44424 --- [nio-9876-exec-4] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported]

and accordingly in my service I get the error [Request processing failed; nested exception is feign.FeignException$MethodNotAllowed: [405] during [GET] to [http://digital-cash/digital-cash/internal/api/v1/digital/token/211671606232197] [DigitalCashTokenFeign#getDigitalCashToken(String)]: [{"timestamp":1676564996373,"status":405,"error":"Method Not Allowed","path":"/digital-cash/internal/api/v1/digital/token/211671606232197"}]] with root cause

Comment From: OlgaMaciaszek

Hello @Fortage, we haven't really introduced dedicated support for Kotlin. Are you experiencing the same issue if you rewrite this code to Java? If yes, please provide a minimal, complete, verifiable example that reproduces the issue.

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Comment From: gviczai

I think nothing is wrong with Feign itself. I faced a similar problem, although with a complex Object as the parameter. I successfully solved it, by recognizing: 1) If one does not specify @SpringQueryMap beside @Parameter, Feign converts the parameter object to a json and puts it to the body of the request. 2) Since GET requests with body are not really conform to http standards, the default http client used by Feign automatically converts the GET to POST. This, however can be worked around: if one adds Apache Http client 5 as dependency to the project, Feign will use it automatically instead of the java.net.http.HttpClient. And Apache's client does not changes the method, so it will stay GET. (Please note that the parameter object will still travel in the body as a json.) Simply put this to your pom.xml:

        <dependency>
            <groupId>io.github.openfeign</groupId>
            <artifactId>feign-hc5</artifactId>
        </dependency>

Spring Boot's autoconfigure feature will handle the rest.

I know this is not exactly the situation you are facing, but I hope this information might help you to search for the cause of your problem at the right place. Maybe you just need to add a @SpringQueryMap or @feign.QueryMap annotation to the parameter?

Comment From: fleboulch

Thanks for your comment @gviczai! It helps me a lot!
Where do you find this kind of information for my personal culture?

Comment From: chaotickid

@gviczai Thanks !! Previously I was also facing same issue. GET request is automatically converting into POST request and downstream application throwing error like POST not supported. Then adding this dependency <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-hc5</artifactId> </dependency> I am not able to get proper request at down stream application. Thanks a lot.

I am using this depedency in the project. <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.13</version> </dependency> + spring boot 3.1.0 and <spring-cloud.version>2022.0.3</spring-cloud.version>

Comment From: alabenkhlifa

@gviczai In my case this was my problem. I signed in just to say thank you, you saved me.