Rename rw, req to w, r

This commit is contained in:
adnano
2020-10-13 20:22:12 -04:00
parent 67842c6425
commit faf94d8ba5
4 changed files with 81 additions and 81 deletions

10
fs.go
View File

@@ -24,19 +24,19 @@ type fsHandler struct {
FS
}
func (fsh fsHandler) Serve(rw *ResponseWriter, req *Request) {
path := path.Clean(req.URL.Path)
func (fsh fsHandler) Serve(w *ResponseWriter, r *Request) {
path := path.Clean(r.URL.Path)
f, err := fsh.Open(path)
if err != nil {
NotFound(rw, req)
NotFound(w, r)
return
}
// Detect mimetype
ext := filepath.Ext(path)
mimetype := mime.TypeByExtension(ext)
rw.SetMimetype(mimetype)
w.SetMimetype(mimetype)
// Copy file to response writer
io.Copy(rw, f)
io.Copy(w, f)
}
// TODO: replace with io/fs.FS when available