Hi there!
I'm using fasthttp as a reverse proxy, and I'd like to stream the response back to the client rather than flush it at the end in one go. This is because we tend to serve large requests which can last a while, so streaming would be ideal.
I'm creating a fasthttp.HostClient to perform the proxying of request and then return a response back to the client. I can't find any setting which would allow me to stream the response back in chunks though - is there one? If not, would it be possible for me to somehow "tap" into the response from the destination host and stream it back in chunks?
As far as I can tell, the populating of the response happens on this line, and so I'm wondering if there's any way to "tap" into that and flush the output periodically?
Any help or pointers would be super appreciated! If there's any more info I can give or some code samples just let me know! :)
The problem at the moment is that the fasthttp client always reads the whole body into memory before returning to the program. This is not ideal and should probably be changed in the future to be more like net/http where the body is returned as an io.Reader and the program can decide what to do with it.
For now I'm closing this issue due to age.
Most helpful comment
The problem at the moment is that the fasthttp client always reads the whole body into memory before returning to the program. This is not ideal and should probably be changed in the future to be more like net/http where the body is returned as an io.Reader and the program can decide what to do with it.
For now I'm closing this issue due to age.