@FeignClient with decode404 set doesn't return Optional.empty on 404
See original GitHub issueFor a method which returns something of type Optional, when decode404 is set to true and you receive a 2xx response, then the type is correctly wrapped into an Optional. If you receive a 404 response, then null is returned rather than Optional.empty().
I would expect Optional.empty() to be returned if 404 is returned and decode404 is set.
Example:
@FeignClient(decode404 = true)
public interface SecondService {
@RequestMapping(method = RequestMethod.GET, value = "/foo/{id}")
Optional<Foo> getFoo(@PathVariable("id") String id);
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
spring boot feign client getting HTTP 404 - Stack Overflow
As far as this answer goes, feign client either from openfeign or spring cloud, doesn't matter. Its just a http client implementation. So...
Read more >feign client 404 handle
If you have decode404 set to true, then GET will return Optional.empty () when it gets 404 but PUT will just return and...
Read more >Spring Cloud OpenFeign
Spring Cloud lets you take full control of the feign client by declaring additional configuration (on top of the FeignClientsConfiguration ) using @FeignClient...
Read more >Introduction to Spring Cloud OpenFeign - Baeldung
In this tutorial, we're going to describe Spring Cloud OpenFeign — a declarative REST client for Spring Boot apps.
Read more >Tackling complexity in the heart of Spring Cloud Feign errors
Unfortunately (or not) I'm not going to explain how to set all this up here, ... types in FeignClient to get an empty...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Stepping through the test, when it does work, it’s via
com.fasterxml.jackson.datatype.jdk8.OptionalDeserializer. Looks like you opened this issue with jackson already https://github.com/FasterXML/jackson-datatype-jdk8/issues/2@PauloJorgeJunior if you are having this problem please open an issue in Spring Cloud OpenFeign and include a sample that reproduces the problem