1
0
mirror of https://github.com/labstack/echo.git synced 2025-12-03 22:59:09 +02:00

Issue 655 (#657)

* Closes #655, closes #649

Signed-off-by: Vishal Rana <vr@labstack.com>

* Added http/1.1 to the list
This commit is contained in:
Vishal Rana
2016-09-12 06:18:58 -07:00
committed by GitHub
parent 03efe4d61b
commit 322b375a37
5 changed files with 69 additions and 15 deletions

13
echo.go
View File

@@ -58,6 +58,7 @@ import (
type (
// Echo is the top-level framework instance.
Echo struct {
server engine.Server
premiddleware []MiddlewareFunc
middleware []MiddlewareFunc
maxParam *int
@@ -569,16 +570,20 @@ func (e *Echo) ServeHTTP(req engine.Request, res engine.Response) {
}
// Run starts the HTTP server.
func (e *Echo) Run(s engine.Server) {
func (e *Echo) Run(s engine.Server) error {
e.server = s
s.SetHandler(e)
s.SetLogger(e.logger)
if e.Debug() {
e.SetLogLevel(glog.DEBUG)
e.logger.Debug("running in debug mode")
}
if err := s.Start(); err != nil {
panic(fmt.Sprintf("echo: %v", err))
}
return s.Start()
}
// Stop stops the HTTP server.
func (e *Echo) Stop() error {
return e.server.Stop()
}
// NewHTTPError creates a new HTTPError instance.