diff --git a/http.go b/http.go index 9189528..3aa6496 100644 --- a/http.go +++ b/http.go @@ -10,6 +10,7 @@ import ( "os" "strings" + "go.wit.com/lib/protobuf/httppb" "go.wit.com/log" ) @@ -79,32 +80,13 @@ func okHandler(w http.ResponseWriter, r *http.Request) { } if route == "/favicon.ico" { - writeFile(w, "ipv6.png") + httppb.WriteFile(w, resources, "ipv6.png") return } log.Warn("BAD URL =", route) } -func writeFile(w http.ResponseWriter, filename string) { - // fmt.Fprintln(w, "GOT TEST?") - fullname := "resources/" + filename - pfile, err := resources.ReadFile(fullname) - if err != nil { - log.Println("ERROR:", err) - // w.Write(pfile) - return - } - - var repohtml string - repohtml = string(pfile) - if filename == "goReference.svg" { - w.Header().Set("Content-Type", "image/svg+xml") - } - fmt.Fprintln(w, repohtml) - log.Println("writeFile() found internal file:", filename) -} - // starts and sits waiting for HTTP requests func startHTTP() { http.HandleFunc("/", okHandler)