Skip to content

[httpclient] Don't consume HTTP responses#502

Merged
baev merged 1 commit into
allure-framework:masterfrom
Inform-Software:dont-consume-response
Mar 26, 2021
Merged

[httpclient] Don't consume HTTP responses#502
baev merged 1 commit into
allure-framework:masterfrom
Inform-Software:dont-consume-response

Conversation

@TobiX
Copy link
Copy Markdown
Contributor

@TobiX TobiX commented Jan 5, 2021

Context

Since the LoggableEntity defined in AllureHttpClientResponse doesn't overwrite all methods of HttpEntityWrapper, there are code paths around it, which modifies the behaviour of response objects when this interceptor is attached to the HTTP client. I noticed this with code which was using BufferedHttpEntity when reading from the responce and running into "Stream already consumed" errors...

This change does away with the custom entity wrapper and uses BufferedHttpEntity, which is designed for exactly this usecase. As an additional optimization, we don't replace the HttpEntity at all if the returned entity is already "repeatable".

Checklist

@TobiX
Copy link
Copy Markdown
Contributor Author

TobiX commented Jan 6, 2021

Something I noticed here: Is it a good idea to preserve requests/responses of any size? Maybe add a default limit to ~100kB, so the user won't shoot himself in the foot if tests contain large requests/responses?

@TobiX
Copy link
Copy Markdown
Contributor Author

TobiX commented Jan 21, 2021

@baev Ping? I cannot fix the one failing check because I cannot change labels on the issue.

@baev
Copy link
Copy Markdown
Member

baev commented Mar 26, 2021

closed & reopened to trigger actions

@baev baev closed this Mar 26, 2021
@baev baev reopened this Mar 26, 2021
@baev baev added the type:bug Something isn't working label Mar 26, 2021
@baev
Copy link
Copy Markdown
Member

baev commented Mar 26, 2021

Is it a good idea to preserve requests/responses of any size? Maybe add a default limit to ~100kB, so the user won't shoot himself in the foot if tests contain large requests/responses?

Yeah, thats actually sounds right. It would be a nice to have a possibility to configure body size limit with some suitable defaults. Feel free to provide a PR with that change ;)

@baev baev merged commit 03bc59f into allure-framework:master Mar 26, 2021
@baev
Copy link
Copy Markdown
Member

baev commented Mar 26, 2021

@TobiX thanks!

@TobiX TobiX deleted the dont-consume-response branch March 26, 2021 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:httpclient type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants