question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Streaming doesn't seem to be working

See original GitHub issue

Checklist

  • I’ve searched for similar issues.
  • I’m using the the latest version of HTTPie.

Version 2.4.0


What are the steps to reproduce the problem?

Hit any streaming API endpoint, even the one in the documentation. Examples:

  1. http -S pie.dev/stream/3
  2. http -S pie.dev/drip

What is the expected result? That the response data shows in the output immediately when it was received. Data should stream.

What happens instead? The full response data is buffered and is printed at the end of the response. Data doesn’t stream.

Debug output

Please re-run the command with --debug, then copy the entire command & output and paste both below:

~> http --debug -S pie.dev/stream/3          
HTTPie 2.4.0
Requests 2.25.1
Pygments 2.7.4
Python 3.9.4 (default, Apr  5 2021, 01:49:30) 
[Clang 12.0.0 (clang-1200.0.32.29)]
/usr/local/Cellar/httpie/2.4.0/libexec/bin/python3.9
Darwin 19.6.0

<Environment {'colors': 256,
 'config': {'default_options': []},
 'config_dir': PosixPath('/Users/shri/.config/httpie'),
 'devnull': <property object at 0x10f8e4db0>,
 'is_windows': False,
 'log_error': <function Environment.log_error at 0x10f8e6ee0>,
 'program_name': 'http',
 'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
 'stderr_isatty': True,
 'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>,
 'stdin_encoding': 'utf-8',
 'stdin_isatty': True,
 'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>,
 'stdout_encoding': 'utf-8',
 'stdout_isatty': True}>

>>> requests.request(**{'auth': None,
 'data': RequestJSONDataDict(),
 'headers': {'User-Agent': b'HTTPie/2.4.0'},
 'method': 'get',
 'params': <generator object MultiValueOrderedDict.items at 0x10f9a1b30>,
 'url': 'http://pie.dev/stream/3'})

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
CF-Cache-Status: DYNAMIC
CF-RAY: 64a69c9f1e561944-SIN
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json
Date: Wed, 05 May 2021 02:41:47 GMT
NEL: {"max_age":604800,"report_to":"cf-nel"}
Report-To: {"max_age":604800,"group":"cf-nel","endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?s=BJF%2BeIdKlobpl92YeRYjpUHuxKkt4wN5vChg5EqcVZylH74PhJP8H%2BIJcCQr0i2CfaAczTaDltcM7sP1jUUQnoaKRTpM5Us7"}]}
Server: cloudflare
Set-Cookie: __cfduid=d7bbf175a872da20d622e08c840b1864f1620182507; expires=Fri, 04-Jun-21 02:41:47 GMT; path=/; domain=.pie.dev; HttpOnly; SameSite=Lax
Transfer-Encoding: chunked
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
cf-request-id: 09dc00376d00001944e711d000000001

{
    "args": {},
    "headers": {
        "Accept": "*/*",
        "Accept-Encoding": "gzip",
        "Cdn-Loop": "cloudflare",
        "Cf-Connecting-Ip": "49.204.224.183",
        "Cf-Ipcountry": "IN",
        "Cf-Ray": "64a69c9f1e561944-FRA",
        "Cf-Request-Id": "09dc00376d00001944e711d000000001",
        "Cf-Visitor": "{\"scheme\":\"http\"}",
        "Connection": "Keep-Alive",
        "Host": "pie.dev",
        "User-Agent": "HTTPie/2.4.0"
    },
    "id": 0,
    "origin": "49.204.224.183",
    "url": "http://pie.dev/stream/3"
}

{
    "args": {},
    "headers": {
        "Accept": "*/*",
        "Accept-Encoding": "gzip",
        "Cdn-Loop": "cloudflare",
        "Cf-Connecting-Ip": "49.204.224.183",
        "Cf-Ipcountry": "IN",
        "Cf-Ray": "64a69c9f1e561944-FRA",
        "Cf-Request-Id": "09dc00376d00001944e711d000000001",
        "Cf-Visitor": "{\"scheme\":\"http\"}",
        "Connection": "Keep-Alive",
        "Host": "pie.dev",
        "User-Agent": "HTTPie/2.4.0"
    },
    "id": 1,
    "origin": "49.204.224.183",
    "url": "http://pie.dev/stream/3"
}

{
    "args": {},
    "headers": {
        "Accept": "*/*",
        "Accept-Encoding": "gzip",
        "Cdn-Loop": "cloudflare",
        "Cf-Connecting-Ip": "49.204.224.183",
        "Cf-Ipcountry": "IN",
        "Cf-Ray": "64a69c9f1e561944-FRA",
        "Cf-Request-Id": "09dc00376d00001944e711d000000001",
        "Cf-Visitor": "{\"scheme\":\"http\"}",
        "Connection": "Keep-Alive",
        "Host": "pie.dev",
        "User-Agent": "HTTPie/2.4.0"
    },
    "id": 2,
    "origin": "49.204.224.183",
    "url": "http://pie.dev/stream/3"
}

Provide any additional information, screenshots, or code examples below:

https://user-images.githubusercontent.com/120119/117091661-a53fc500-ad79-11eb-8338-4df206b98f36.mov

https://user-images.githubusercontent.com/120119/117091670-ad980000-ad79-11eb-8fd9-18596376c133.mov

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jakubroztocilcommented, May 5, 2021

@sharat87 in HTTPie, --stream is for line-by-line processing. The /drip endpoint returns only one line of text. Therefore, --stream has no effect there. HTTPie currently doesn‘t have an equivalent to curl’s -N, --no-buffer.

0reactions
sharat87commented, May 5, 2021

I see. Thank you very much for the response. I didn’t realize --stream only works on line streaming. Thank you for the detail. Please consider adding this note to the documentation.

Closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

10 Simple Ways To Fix All Video Streaming Issues
The 10 methods to fix video streaming problems include: · Check the internet connectivity · Switch to a different streaming platform · Reduce...
Read more >
Troubleshoot your YouTube live stream - Google Help
If you're having issues with your YouTube live stream, use the troubleshooting tips below. In addition to these tips, you can always post...
Read more >
Live streaming problems: Troubleshooting tips and fixes
Having issues with your live stream ? From networking issues to problems with streaming software or hardware, a lot can happen to hurt...
Read more >
How To Troubleshoot Common Live Streaming Issues
How To Troubleshoot Common Live Streaming Issues: A Comprehensive Guide · 1. Check Your Internet Connection · 2. Prepare Your Devices · 3....
Read more >
YouTube™, Netflix, or other streaming app doesn't work.
If the streaming app you use has an account login, sign out and then sign back into the app. Make sure the TV...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found