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

Feature request: "chunked" header in /drip #479

Open
Lucretiel opened this issue Jun 29, 2018 · 7 comments
Open

Feature request: "chunked" header in /drip #479

Lucretiel opened this issue Jun 29, 2018 · 7 comments

Comments

@Lucretiel
Copy link
Contributor

It'd be nice if the /drip endpoint accepted an additional header, called chunked, which (if given as true) would make it so that /drip doesn't use a content-length, and instead uses chunked encoding. This would be nice for testing clients that are designed to consume "live" data.

@Lucretiel
Copy link
Contributor Author

If there's support for this I can put together a pull request

@javabrett
Copy link
Contributor

Just checking that neither /range or /stream-bytes fill that need.

@Lucretiel
Copy link
Contributor Author

The specific thing I'm trying to test is early termination— that is, cancelling a request that is in the middle of streaming a body. For that reason, it would be very helpful to have a request that streams over a duration, so that I can easily initiate termination halfway through it.

@Lucretiel Lucretiel reopened this Jun 29, 2018
@Lucretiel
Copy link
Contributor Author

They're both close, but not quite there. /range supports a duration parameter, but doesn't use the chunked transfer encoding. /stream-bytes does do chunked encoding, but doesn't have a tuneable duration.

@georgir
Copy link

georgir commented Aug 15, 2018

A note for those still looking for such endpoint - /stream-bytes has an undocumented parameter chunk_size that can be helpful. By default it is 10k, making the endpoint appear non-streaming for smaller responses. The max response length it can return is 100k, making for just 10 chunks with the default chunk_size.

A chunk_size of 1 makes the endpoint considerably slow - around 1k/s, so it seems it could be useful for cases like what Lucretiel needed.

Also, from testing it seems even if you request a chunk_size of 1, you get quite a larger chunk size. I base this conclusion on the "transfer-size" field in browser dev tools - it should be 6 times higher than the content size if each chunk were a single byte, but it's barely higher in practice. My guess is that the reverse proxy ("vegur") in front of httpbin.org re-chunks the response.

@dswitzer
Copy link

I was very disappointed to discover that drip doesn't support chunked responses. That endpoint seems like you'd want chunked responses by default. So make me a +1 for wishing it supported chunked responses!

@anonghuser
Copy link

anonghuser commented May 17, 2024

@dswitzer and others looking at this in the future
i don't remember how things worked back in 2018 anymore, but now httpbin.org's servers use http/2 protocol where there is no such thing as explicit transfer-encoding: chunked header, and instead its functionality is supported by default. /drip endpoint works fine with it when i test. i would say this issue can be closed
demo

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

No branches or pull requests

5 participants