Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response.InputStreamBody's toString method closes input stream. #1208

Open
TJReinert opened this issue Apr 8, 2020 · 2 comments
Open

Response.InputStreamBody's toString method closes input stream. #1208

TJReinert opened this issue Apr 8, 2020 · 2 comments
Labels
proposal Proposed Specification or API change

Comments

@TJReinert
Copy link

The toString() on Response.InputStreamBody causes the underlying inputstream to be closed.
0a0ff3f

When using IntellJ the default behavior while debugging is to call any toString methods that have been overridden.
image

You can disable this functionality but it would be nice if the toString method just returned a copy of the data.

I have opened a ticket with IntelliJ to allow an 'excludes' list.
https://youtrack.jetbrains.com/issue/IDEA-237009

Thoughts?

@swapneelapte
Copy link

Hi,
I was facing IO exception with message stream is closed . I disabled toString object view which you suggested above, I was able to read body from response.
Thanks for sharing the information.

@kdavisk6
Copy link
Member

I agree we should change this. My suggestion would be to not ready the data in toString() at all. Thoughts?

@kdavisk6 kdavisk6 added the feedback provided Feedback has been provided to the author label Apr 25, 2020
@kdavisk6 kdavisk6 added proposal Proposed Specification or API change and removed feedback provided Feedback has been provided to the author labels Dec 29, 2020
kdavisk6 added a commit to kdavisk6/feign that referenced this issue Dec 29, 2020
Fixes: OpenFeign#1208

Forgot to add Defate support and removed the implicit parsing of the
body during toString.  This was also brought up in OpenFeign#1208 and it came up
during testing of this change.  Users should be using our `asReader`
and other methods to access the response body.
kdavisk6 added a commit to kdavisk6/feign that referenced this issue Dec 31, 2020
Fixes: OpenFeign#1208

Forgot to add Defate support and removed the implicit parsing of the
body during toString.  This was also brought up in OpenFeign#1208 and it came up
during testing of this change.  Users should be using our `asReader`
and other methods to access the response body.
kdavisk6 added a commit that referenced this issue Jan 8, 2021
Fixes: #934, #1208

This change updates the Input Stream handling when using the Default
client implementation to detect when a response is `gzipped` and
wrap it in a `GZipInputStream`.

This addresses any issues related to compression when using the
default client.

In addition, removed the implicit parsing of the
body during toString.  This was also brought up in #1208 and it came up
during testing of this change.  Users should be using our `asReader`
and other methods to access the response body.

* Adding Deflate support
* Added Deflate Support and removed implicit response body reading
* Refactored Gzip and Deflate Conditions
* Corrected formatting and line-endings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Proposed Specification or API change
Projects
None yet
Development

No branches or pull requests

3 participants