Rename getHttpr to GetHandler

This commit is contained in:
Nise Void 2023-04-08 18:07:22 +02:00
parent 283c75b32e
commit 2120b5da8f
1 changed files with 3 additions and 4 deletions

View File

@ -97,7 +97,7 @@ func (r *Router) OPTIONS(path string, handle Handle, middleware ...Middleware) {
// Start starts the web server and binds to the given address
func (r *Router) Start(addr string) error {
httpr := r.getHttpr()
httpr := r.GetHandler()
r.server = &http.Server{Addr: addr, Handler: httpr}
return r.server.ListenAndServe()
@ -105,7 +105,7 @@ func (r *Router) Start(addr string) error {
// StartTLS starts a TLS web server using the given key, cert and config and binds to the given address
func (r *Router) StartTLS(addr, certFile, keyFile string, conf *tls.Config) error {
httpr := r.getHttpr()
httpr := r.GetHandler()
r.server = &http.Server{Addr: addr, Handler: httpr, TLSConfig: conf}
return r.server.ListenAndServeTLS(certFile, keyFile)
@ -128,7 +128,7 @@ func (r *Router) Stop() error {
return err
}
func (r *Router) getHttpr() http.Handler {
func (r *Router) GetHandler() http.Handler {
httpr := httprouter.New()
for _, v := range r.routes {
@ -232,7 +232,6 @@ func handleReq(r *Router, handle Handle, m []Middleware) httprouter.Handle {
}
err := f(c)
if err != nil {
r.ErrorHandler(c, err)
}