Update some comments, add function name prefix to comment

This commit is contained in:
mstmdev 2022-03-21 01:32:53 +08:00
parent 9701b651b7
commit 33409e04d1

View File

@ -23,23 +23,23 @@ type ResponseWriter interface {
http.Flusher http.Flusher
http.CloseNotifier http.CloseNotifier
// Returns the HTTP response status code of the current request. // Status returns the HTTP response status code of the current request.
Status() int Status() int
// Returns the number of bytes already written into the response http body. // Size returns the number of bytes already written into the response http body.
// See Written() // See Written()
Size() int Size() int
// Writes the string into the response body. // WriteString writes the string into the response body.
WriteString(string) (int, error) WriteString(string) (int, error)
// Returns true if the response body was already written. // Written returns true if the response body was already written.
Written() bool Written() bool
// Forces to write the http header (status code + headers). // WriteHeaderNow forces to write the http header (status code + headers).
WriteHeaderNow() WriteHeaderNow()
// get the http.Pusher for server push // Pusher get the http.Pusher for server push
Pusher() http.Pusher Pusher() http.Pusher
} }
@ -107,12 +107,12 @@ func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return w.ResponseWriter.(http.Hijacker).Hijack() return w.ResponseWriter.(http.Hijacker).Hijack()
} }
// CloseNotify implements the http.CloseNotify interface. // CloseNotify implements the http.CloseNotifier interface.
func (w *responseWriter) CloseNotify() <-chan bool { func (w *responseWriter) CloseNotify() <-chan bool {
return w.ResponseWriter.(http.CloseNotifier).CloseNotify() return w.ResponseWriter.(http.CloseNotifier).CloseNotify()
} }
// Flush implements the http.Flush interface. // Flush implements the http.Flusher interface.
func (w *responseWriter) Flush() { func (w *responseWriter) Flush() {
w.WriteHeaderNow() w.WriteHeaderNow()
w.ResponseWriter.(http.Flusher).Flush() w.ResponseWriter.(http.Flusher).Flush()