rename routeHandler in r2-image-server to ServeHTTP

This commit is contained in:
syumai 2022-05-30 08:39:10 +09:00
parent 5c55a2ebf7
commit 51d52249fc

View File

@ -94,7 +94,7 @@ func (s *server) delete(w http.ResponseWriter, req *http.Request, key string) {
w.Write([]byte("successfully deleted image"))
}
func (s *server) routeHandler(w http.ResponseWriter, req *http.Request) {
func (s *server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
key := strings.TrimPrefix(req.URL.Path, "/")
switch req.Method {
case "GET":
@ -119,5 +119,5 @@ func main() {
fmt.Fprintf(os.Stderr, "failed to start server: %v", err)
os.Exit(1)
}
workers.Serve(http.HandlerFunc(s.routeHandler))
workers.Serve(s)
}