-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Server-sent events explicitly requires --stream #376
Comments
Actually, the best behaviour is to auto-enable import requests
r = requests.get('http://localhost:1729/stream/all')
print_headers(r)
print_body(r) What it does with import requests
r = requests.get('http://localhost:1729/stream/all', stream=True)
print_headers(r)
print_body(r) This means that by the time httpie has received the headers it's too late to begin streaming. httpie would need to perform a The one way to acommodate this would be for httpie to always pass I'm not sure if @jkbrzt wants httpie to absorb some logic from it's dependencies though just to perform some magic. |
If a proper fix is not feasible for the reasons @sigmavirus24 details above, perhaps issuing some kind of warning at the console could be an option. Presumably, I ran into this issue and thought I must be doing something wrong on the server side. For example, like @mivade, I was doing something like this:
Then—after considerable time debugging the server side—I tried the same request with
Only then did I think to search through HTTPie's GitHub issues, at which point I found on this issue. Emitting a warning message as suggested above would save others from going through the same effort in the future. Also, if the user is explicitly specifying an |
So, the underlying transport library, will try to read the entire response before giving control back to HTTPie. To solve this, the best course of action is for HTTPie to always stream responses unless told not to. This will not incur a performance penalty for HTTPie. |
Hi, I'm a newbie to open source projects. I would like to contribute to make HTTPie to automatically recognize server sent events. Could you please provide me with more info and can I work on this issue? |
Any news on this? I've the same problem... a simple warning would saved hours of debugging. |
To people who want to work on this, it looks like httpie already streams responses by default. The trick is now to find where to add support for auto-enabling |
@sigmavirus24 great suggestion, I'll look into that. |
Hey all, |
If I have a server-sent event source and try to simply do
I get output that looks something like this:
followed by none of the streamed data. This can be worked around by setting the
--stream
flag. However, better behavior would be to automatically enable streaming support whenContent-Type
istext/event-stream
.The text was updated successfully, but these errors were encountered: