Compare commits
No commits in common. "export_handler" and "master" have entirely different histories.
export_han
...
master
@ -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.GetHandler()
|
||||
httpr := r.getHttpr()
|
||||
|
||||
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.GetHandler()
|
||||
httpr := r.getHttpr()
|
||||
|
||||
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) GetHandler() http.Handler {
|
||||
func (r *Router) getHttpr() http.Handler {
|
||||
httpr := httprouter.New()
|
||||
|
||||
for _, v := range r.routes {
|
||||
@ -232,6 +232,7 @@ func handleReq(r *Router, handle Handle, m []Middleware) httprouter.Handle {
|
||||
}
|
||||
|
||||
err := f(c)
|
||||
|
||||
if err != nil {
|
||||
r.ErrorHandler(c, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user