Skip to content

Instantly share code, notes, and snippets.

@andreinechaev
Created February 18, 2016 17:49
Show Gist options
  • Save andreinechaev/9dff27f9b7fff7b6e7c0 to your computer and use it in GitHub Desktop.
Save andreinechaev/9dff27f9b7fff7b6e7c0 to your computer and use it in GitHub Desktop.
package main
import "net/http"
func main() {
changeHeaderThenServe := func(h http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
h.ServeHTTP(w, r)
}
}
http.Handle("/", changeHeaderThenServe(http.FileServer(http.Dir("."))))
http.ListenAndServe(":8000", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment