Forward dismiss404 from CoroutineFeign builder to AsyncFeign#3371
Open
seonwoo-jung wants to merge 1 commit into
Open
Forward dismiss404 from CoroutineFeign builder to AsyncFeign#3371seonwoo-jung wants to merge 1 commit into
seonwoo-jung wants to merge 1 commit into
Conversation
CoroutineFeign.CoroutineBuilder inherits the dismiss404 setter from BaseBuilder, but internalBuild() created a fresh AsyncFeign.builder() chain that never forwarded the flag, so dismiss404() configured on a CoroutineBuilder had no effect at runtime: a 404 response still produced a FeignException instead of being passed to the decoder. Split the chain so the configured dismiss404 value is applied to the underlying AsyncBuilder before build(). Adds a unit test that verifies the decoder is invoked for a 404 response when dismiss404 is set on the CoroutineBuilder. Fixes OpenFeign#2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CoroutineFeign.CoroutineBuilderinheritsdismiss404()fromBaseBuilder, butinternalBuild()constructed a freshAsyncFeign.builder()chain that never forwarded the flag. As a result, calling.dismiss404()on a coroutine builder silently had no effect — a 404 response still produced aFeignExceptioninstead of being routed through the decoder.Fix
Split the existing builder chain so the configured
dismiss404value is applied to the underlyingAsyncBuilderbeforebuild():The conditional mirrors
BaseBuilder.dismiss404()semantics (a one-way switch); preserving the defaultfalsebehavior when the user doesn't opt in.Test
Adds
CoroutineFeignTest.\sut should dismiss 404 responses when dismiss404 is configured on CoroutineBuilder`, modeled onAsyncFeignTest.decodingDoesNotSwallow404ErrorsInDismiss404Mode. The test enqueues a 404, installs a recordingDecoder`, and asserts that:FeignException.response.status() == 404, proving the dismiss-404 path engaged.Without the fix, the call would throw on the 404 before the decoder is ever called.
Fixes #2026