Skip to content

Commit

Permalink
Don't need a named function for the static mapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed May 3, 2012
1 parent e3af242 commit dd140a5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions vbmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ func files(contentType string, paths ...string) handler {
}
}

func doStatic(w http.ResponseWriter, req *http.Request) {
http.ServeFile(w, req, filepath.Join(".", req.URL.Path))
}

func main() {
staticPath := flag.Bool("static", false,
"Interpret URL as a static path (for testing)")
Expand All @@ -188,7 +184,9 @@ func main() {
http.HandleFunc("/custom", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/static/custom.html", http.StatusMovedPermanently)
})
http.HandleFunc("/static/", doStatic)
http.HandleFunc("/static/", func(w http.ResponseWriter, req *http.Request) {
http.ServeFile(w, req, filepath.Join(".", req.URL.Path))
})

if *staticPath {
http.HandleFunc("/map", files("application/javascript", flag.Args()...))
Expand Down

0 comments on commit dd140a5

Please sign in to comment.