Skip to content

Streaming decoder support2 - #3551

Open
trumpetinc wants to merge 2 commits into
OpenFeign:14.xfrom
trumpetinc:streaming_decoder_support2
Open

Streaming decoder support2#3551
trumpetinc wants to merge 2 commits into
OpenFeign:14.xfrom
trumpetinc:streaming_decoder_support2

Conversation

@trumpetinc

Copy link
Copy Markdown
Collaborator

Adds support for streaming decode for Feign RequestLine methods that return InputStream or Reader.

To use:

  interface LargeStreamTestInterface {

    @RequestLine("GET /")
    InputStream getLargeStream();

    @RequestLine("GET /")
    Reader getLargeReader();
  }
public void test(){
  try(InputStream is = myLargeStreamTestInterface.getLargeStream()){
     // process the is
  }
}

Changes

  1. InvocationContext now leaves the response stream open if the return type from the decoder implements Closeable
  2. New InputStreamAndReaderDecoder class that can be registered with the Feign builder.decoder() method. Supports passing the decode request to a delegate if the method return type is not InputStream or Reader. If the return type is Reader, the charset of the response Content-Type header is used. If no charset is specified in the header, UTF-8 is assumed.
  3. New ContentTypeParser utility method for obtaining information from the Content-Type header

@trumpetinc

Copy link
Copy Markdown
Collaborator Author

Fixing problems with initial git branch ( #3494 )

@trumpetinc

Copy link
Copy Markdown
Collaborator Author

@velo let's try this - I have no idea what I messed up with the git branching on the earlier PR. This PR is as clean as I can make it. I branched from the latest 14.x and made the required changes.

CircleCI is already complaining about build problems (certainly nothing to do with this PR itself??):

wget: Failed to fetch https://downloads.apache.org/maven/mvnd/1.0.2/maven-mvnd-1.0.2-linux-amd64.zip

But at least security snyk checked out this time.

@trumpetinc
trumpetinc requested a review from velo September 1, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant