Make ResponseWriter an interface

This commit is contained in:
Adnan Maolood
2021-02-09 09:45:10 -05:00
parent 5ef5824d6f
commit f6824bd813
6 changed files with 52 additions and 39 deletions

4
mux.go
View File

@@ -132,7 +132,7 @@ func (mux *ServeMux) shouldRedirectRLocked(path string) bool {
// ServeGemini dispatches the request to the handler whose
// pattern most closely matches the request URL.
func (mux *ServeMux) ServeGemini(w *ResponseWriter, r *Request) {
func (mux *ServeMux) ServeGemini(w ResponseWriter, r *Request) {
path := cleanPath(r.URL.Path)
// If the given path is /tree and its handler is not registered,
@@ -202,7 +202,7 @@ func appendSorted(es []muxEntry, e muxEntry) []muxEntry {
}
// HandleFunc registers the handler function for the given pattern.
func (mux *ServeMux) HandleFunc(pattern string, handler func(*ResponseWriter, *Request)) {
func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request)) {
if handler == nil {
panic("gemini: nil responder")
}