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

HttpLoggingInterceptor with Level.BODY blocks SSE from reading response #4298

Closed
alextcn opened this issue Oct 1, 2018 · 3 comments
Closed
Labels
bug Bug in existing code
Milestone

Comments

@alextcn
Copy link

alextcn commented Oct 1, 2018

The problem is that SSE doesn't work with HttpLoggingInterceptor that have Level.BODY. Interceptor with other levels are working as expected.

HttpLoggingInterceptor with Level.BODY is not allowing RealEventSource to read response body byte by byte. It looks like interceptor is trying to buffer the entire response body which is not ready until request is done. Therefore Callback.onResponse in RealEventSource doesn't called, response events can't be parsed and passed to EventSourceListener.

The solution could be ignoring response body in HttpLoggingInterceptor for Content-Type: text/event-stream, reading response body line by line or just an explicit warning of not using Level.BODY with SEE in documentation.

Changing log level from Level.BODY for SSE client wouldn't be the best solution because it will also disable logging a body for regular HTTP requests for this client instance.

@JakeWharton
Copy link
Collaborator

Want to send a PR for this?

@swankjesse
Copy link
Collaborator

I think we wanna change Level.BODY to do streaming-logging, not buffer-everything logging.

@swankjesse swankjesse added the bug Bug in existing code label Nov 4, 2018
@swankjesse swankjesse added this to the 3.13 milestone Nov 4, 2018
@yschimke
Copy link
Collaborator

Won't fix. We have a minimal fix attitude to HttpLoggingInterceptor. It deserves it's own github library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in existing code
Projects
None yet
Development

No branches or pull requests

4 participants