Update some comments, add function name prefix to comment (#3090)

This commit is contained in:
mstmdev
2022-03-23 21:35:09 +08:00
committed by GitHub
parent be0d86edf4
commit 865fd560fc
3 changed files with 25 additions and 24 deletions

View File

@ -23,23 +23,23 @@ type ResponseWriter interface {
http.Flusher
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
// 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()
Size() int
// Writes the string into the response body.
// WriteString writes the string into the response body.
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
// Forces to write the http header (status code + headers).
// WriteHeaderNow forces to write the http header (status code + headers).
WriteHeaderNow()
// get the http.Pusher for server push
// Pusher get the http.Pusher for server push
Pusher() http.Pusher
}
@ -107,12 +107,12 @@ func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return w.ResponseWriter.(http.Hijacker).Hijack()
}
// CloseNotify implements the http.CloseNotify interface.
// CloseNotify implements the http.CloseNotifier interface.
func (w *responseWriter) CloseNotify() <-chan bool {
return w.ResponseWriter.(http.CloseNotifier).CloseNotify()
}
// Flush implements the http.Flush interface.
// Flush implements the http.Flusher interface.
func (w *responseWriter) Flush() {
w.WriteHeaderNow()
w.ResponseWriter.(http.Flusher).Flush()