-
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
Automatically enable --stream on server sent events #1226
Conversation
ef9e3b1
to
3bb573d
Compare
Codecov Report
@@ Coverage Diff @@
## master #1226 +/- ##
==========================================
- Coverage 97.28% 96.72% -0.56%
==========================================
Files 67 81 +14
Lines 4235 5409 +1174
==========================================
+ Hits 4120 5232 +1112
- Misses 115 177 +62
Continue to review full report at Codecov.
|
tests/test_uploads.py
Outdated
@@ -49,7 +49,8 @@ def test_chunked_stdin(httpbin_with_chunked_support): | |||
) | |||
assert HTTP_OK in r | |||
assert 'Transfer-Encoding: chunked' in r | |||
assert r.count(FILE_CONTENT) == 2 | |||
# One original (request) + one encoded (httpbin's response, ascii) | |||
assert r.count(FILE_CONTENT) + r.count(RAW_FILE_CONTENT) == 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for these changes is that, httpbin mirrors the headers when it is responding. Since it is also mirroring the Transfer-Encoding
, we treat this response as if it was chunked and use different delimiting techniques. So because of that, we stop formatting it as JSON, and not decode the actual unicode symbols (since that happens on formatting). Which I think is a plausible behavior, considering in this case, the server is the wrong side.
3bb573d
to
c32b057
Compare
Tests are failing on 3.7/3.6, probably due to some mocking behavior changes. Will look at them on the morning. |
Why is it enabled for all chunked responses? This really only makes sense for server-sent events, where each line can be considered a body. https://httpie.io/docs#disabling-buffering |
Ah, alright! Will do that then, thanks for the correction. I thought you initially meant enabling this for all chunked responses, since the quote in this implied that. Will fix it! |
3ae6745
to
55f4c2c
Compare
55f4c2c
to
fd8897e
Compare
Woah, this is great! I'm not using SSE as much as I was when I filed #376 but this is really nice to see. |
Resolves #376.