I am trying to call the below url from Feign client(org.springframework.cloud.openfeign.FeignClient
) here:
http://localhost:8085/test/send/S.MV00.S0.CAL_EXAMP/KWX0.GAT0.REPLY___EXCHANGE_WITH_OTHER_ONE__.SO/KWX0.GAT0.REPLY___EXCHANGE_WITH_OTHER_ONE__.AI/
I get 404 error in Feign client but in Postman the url works fine.
FeignClient Kotlin code:
import org.springframework.cloud.openfeign.FeignClient
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.http.ResponseEntity
import javax.validation.Valid
@FeignClient(
value = "CalculatorClient",
url = "http://localhost:8085/test/send/S.MV00.S0.CAL_EXAMP/KWX0.GAT0.REPLY___EXCHANGE_WITH_OTHER_ONE__.SO/KWX0.GAT0.REPLY___EXCHANGE_WITH_OTHER_ONE__.AI/"
)
interface CalculatorClient {
@PostMapping
fun calculateInformation(@RequestBody request: @Valid String): ResponseEntity<String?>
}
Provider Java code:
@RestController
@RequestMapping("/test")
public class TestController {
@PostMapping("/send/{destination:.+}/{calculate:.+}/{process:.+}/")
public ResponseEntity<String> sendAndReceive(
@PathVariable final String destination,
@PathVariable final String calculate,
@PathVariable final String process) {
return ResponseEntity.ok("endpoint called");
}
}
How can I fix this in Feign client? Looks like the trailing slash is being removed by Feign Client which is not the case when using RestTemplate.
I cannot change provider code because it is from some other company.