Suppose we have a function that processes an HTTP request, for example:
func handler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("first piece of data"))
w.Write([]byte("second piece of data"))
}
I am wondering if the first w.Write () call is cleared by the client or not?
If it turns red, we actually respond to customers twice, this is strange, because how can we determine Content-Lengthbefore the second call to record?
If it is not flushed (say, the data is buffered locally), then what if we write a huge amount of data on the first call? (will there be a stack overflow?)
Any explanation would be appreciated! :)
source
share