From d6dd84d5351d7360b450b0967ebf29d34932a3f4 Mon Sep 17 00:00:00 2001 From: astaxie Date: Wed, 8 May 2013 16:35:29 +0800 Subject: [PATCH] favicon.ico default deal with static files --- router.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/router.go b/router.go index 7a480ed4..9ba86fca 100644 --- a/router.go +++ b/router.go @@ -223,6 +223,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) //static file server for prefix, staticDir := range StaticDir { + if r.URL.Path == "/favicon.ico" { + file := staticDir + r.URL.Path + http.ServeFile(w, r, file) + w.started = true + return + } if strings.HasPrefix(r.URL.Path, prefix) { file := staticDir + r.URL.Path[len(prefix):] http.ServeFile(w, r, file)