1

I have this MultiValueMap with params which I would like to send as http link key-value values

MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.add("entityId", "123456");
map.add("amount", "123456");

Feign Client:

@FeignClient(name = "Staging", url = "https://test.com")
public interface Client {

    @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    SaleResponse performSaleTransaction(@QueryMap MultiValueMap<String, String> params);
}

But I get exception:

feign.FeignException$BadRequest: [400 Bad Request] during [POST] to [https://test.com] [Client#performSaleTransaction(String,MultiValueMap)]: [{"result":{"code":"200.300.404","description":"invalid or missing parameter","parameterErrors":[{"name":"entityId","value":null,"message":"invalid or missing parameter"}]},"buildNumber":"......","timestamp":"2021-05-23 12:31:52+0000","ndc":"......"}]
        at feign.FeignException.clientErrorStatus(FeignException.java:195)

Looks like Feign cannot convert properly the values from the MultiValueMap. DO you know how I can fix this issue?

Peter Penzov
  • 1,126
  • 134
  • 430
  • 808

1 Answers1

1

I found in sources

if (MAP_STRING_WILDCARD.equals(bodyType)) {
      data = (Map<String, Object>) object;
MAP_STRING_WILDCARD is Map<String,?>

try to change u MultiValueMap<String, String> to Map<String,?>

Alexandr
  • 349
  • 1
  • 4
  • 13