`--stream` does not print entire buffer
Author: devuntCreated Sep 4, 2022Updated Feb 13, 2026
I'm testing streaming SSR react server with xh, and I found that xh does not display entire response unlike what curl does.
Testing against same endpoint with xh and curl:
~ ❱ xh http://127.0.0.1:3000 --stream
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: text/html
Date: Sun, 04 Sep 2022 14:28:37 GMT
Keep-Alive: timeout=72
Transfer-Encoding: chunked
<!DOCTYPE html>
<html>
<head>
<title>hello</title>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, width=device-width" />
</head>
<body>~ ❱ curl http://127.0.0.1:3000 --include
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: text/html
Date: Sun, 04 Sep 2022 14:30:13 GMT
Connection: keep-alive
Keep-Alive: timeout=72
Transfer-Encoding: chunked
<!DOCTYPE html>
<html>
<head>
<title>hello</title>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, width=device-width" />
</head>
<body>~ ❱ curl http://127.0.0.1:3000 --include --no-buffer
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: text/html
Date: Sun, 04 Sep 2022 14:31:16 GMT
Connection: keep-alive
Keep-Alive: timeout=72
Transfer-Encoding: chunked
<!DOCTYPE html>
<html>
<head>
<title>hello</title>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, width=device-width" />
</head>
<body>
<div id="root"><!--$?--><template id="B:0"></template>suspending...<!--/$-->As you can see, content of the body is printed only when curl is used with --no-buffer parameter.
I can't find xh option equivalent with curl --no-buffer from documentation or source code.
Any help would be appriciated!
Source: ducaale/xh