Spring Boot 2.3.1 Spring Cloud OpenFeign 2.2.3 Java 11
Hi! It looks like there is an issue introduced by change #314.
I have following method in my Feign client:
@PostMapping("/api/v2/topics/{topicName}")
Response sendMessage(
@PathVariable("topicName") String topicName,
@RequestBody Message message,
@RequestHeader(value = HttpHeaders.CONTENT_TYPE) String contentHeader);
So, here I'm able to set "Content-Type" header dynamically by passing contentHeader param and this works until Spring Cloud Hoxton.SR5. When I set "spring-cloud-dependencies" version to "Hoxton.SR5" my app start failed with exception:
org.springframework.util.InvalidMimeTypeException: Invalid mime type "{Content-Type}": does not contain '/'
Exception thrown from method org.springframework.cloud.openfeign.support.SpringMvcContract#isMultipartFormData because in the given example of Feign method we have placeholder instead of particular header value and code
MediaType.valueOf(type); // here type = "{Content-Type}"
failed with InvalidMimeTypeException.
Comment From: OlgaMaciaszek
Thanks @PhillipMek Was able to reproduce it.
Comment From: OlgaMaciaszek
@PhillipMek I have also tried running it against Hoxton.SR4, however, it still fails here, and that code was there before the changes you've linked. Can you provide a minimal, complete, verifiable example that works before Hoxton.SR5 and breaks after updating to this version?
Comment From: PhillipMek
@OlgaMaciaszek I forgot to mention that before update to Hoxton.SR5 I used Hoxton.SR2 version, so it works fine on Hoxton.SR2.
Comment From: OlgaMaciaszek
@PhillipMek have just checked on Hoxton.SR2 and am still getting feign.codec.EncodeException. I can work on it anyway, but if you are able to provide a demo where it works for you, it will be easier. Let me know if you are able to provide a sample.
Comment From: PhillipMek
@OlgaMaciaszek not today, maybe I could prepare a sample for you tomorrow.
Comment From: OlgaMaciaszek
Ok. Please do.
Comment From: PhillipMek
@OlgaMaciaszek here is demo which demonstrates the issue I described: https://github.com/PhillipMek/fiegn-example.
There are only one test, this test fails on Hoxton.SR5 and pass on Hoxton.SR4.
Comment From: OlgaMaciaszek
Thanks @PhillipMek will have a look
Comment From: PhillipMek
@OlgaMaciaszek, hi!
I've updated my project to Hoxton.SR7 and it looks like spring-cloud-openfeign-2.2.4.RELEASE does not contain this fix.
Comment From: JonathanAaron
@OlgaMaciaszek was the example that @PhillipMek priced the correct way to provide content type? I have an API that only accepts application/x-www-form-urlencoded. I'm having a hard time to finding the spring way to annotate openfeign. Thank you.