Hi! On Mon, Nov 20, 2023 at 10:51 PM Uli Kunitz <[email protected]> wrote: > You could convert the original ResponseWriter to a ResponseController and > call Flush in your middleware before you measure the duration. Alternatively > you can try to convert ResponseWriter to a http.Flusher and call Flush if the > conversion is successful.
Yes, I was thinking something along those lines. But are there any side effects by calling Flush after the main handler returns? Like in Write documentation it says: "if the total size of all written data is under a few KB and there are no Flush calls, the Content-Length header is added automatically." "Once the headers have been flushed (...), the request body may be unavailable." My understanding is that after the main handler returns, none of this matters anymore. But are there any other similar side effects? Mitar -- https://mitar.tnode.com/ https://twitter.com/mitar_m https://noc.social/@mitar -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAKLmikPFW%3Dh5AJnW1QbMB8%3DKjNKd%3Dook6HYkz%2BuajsXkyBFDPw%40mail.gmail.com.
