diff --git a/go.mod b/go.mod index 3302f01..afa0ca8 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,3 @@ module github.com/kurusugawa-computer/freee-go go 1.21.6 - -require github.com/go-chi/chi/v5 v5.1.0 // indirect diff --git a/go.sum b/go.sum index 823cdbb..e69de29 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +0,0 @@ -github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= -github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= diff --git a/oauth/oauth.go b/oauth/oauth.go index a65a67e..feec797 100644 --- a/oauth/oauth.go +++ b/oauth/oauth.go @@ -10,8 +10,6 @@ import ( "net/url" "strconv" "strings" - - "github.com/go-chi/chi/v5" ) type opt struct { @@ -111,9 +109,15 @@ func Authorize(clientID string, port int, opts ...OptFunc) (string, error) { http.Error(w, "Not Found", http.StatusNotFound) }) - mux := chi.NewRouter() - mux.Handle("/", authHandler) - mux.Handle("/*", notFoundHandler) + mux := http.NewServeMux() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/": + authHandler.ServeHTTP(w, r) + default: + notFoundHandler.ServeHTTP(w, r) + } + }) server := &http.Server{ Addr: fmt.Sprintf(":%d", port),