-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Given:
func newServer(rootDir string) *http.Server {
fs := http.FileServer(http.Dir(rootDir))
mux := http.NewServeMux()
mux.Handle("/", fs)
srv := &http.Server{
Addr: httpPort,
Handler: mux,
}
return srv
}
That should set up a basic usable webserver for static files like, say, the ones generated by the Hugo project right? Wrong.
Js files - served as text/plain. CSS files - text/plain. HTML file, you guessed it, text/plain. While you can configure a browser to ignore this, it throws a wrench into testing.
This is a bug because it renders this library call unusable as far as I can tell.
Every similar library in ever other language I've used infers the content type from the extension by default.
Metadata
Metadata
Assignees
Labels
No labels