Skip to content

Commit bd67a7d

Browse files
committed
Fixed #447
Signed-off-by: Vishal Rana <[email protected]> Updated README.md Signed-off-by: Vishal Rana <[email protected]>
1 parent e687f2a commit bd67a7d

3 files changed

Lines changed: 24 additions & 11 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
- Optimized HTTP router which smartly prioritize routes.
1717
- Build robust and scalable RESTful APIs.
1818
- Run with standard HTTP server or FastHTTP server.
19+
- Group APIs.
1920
- Extensible middleware framework.
20-
- Router groups with nesting.
21+
- Define middleware at root, group of route level.
2122
- Handy functions to send variety of HTTP responses.
2223
- Centralized HTTP error handling.
2324
- Template rendering with any template engine.
25+
- Define your format for the logger.
2426

2527
## Performance
2628

@@ -43,7 +45,7 @@ $ go get github.com/labstack/echo/...
4345

4446
### Hello, World!
4547

46-
Create `main.go`
48+
Create `server.go`
4749

4850
```go
4951
package main
@@ -65,7 +67,7 @@ func main() {
6567
Start server
6668

6769
```sh
68-
$ go run main.go
70+
$ go run server.go
6971
```
7072

7173
Browse to [http://localhost:1323](http://localhost:1323) and you should see

‎echo.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ func (e *Echo) ServeHTTP(rq engine.Request, rs engine.Response) {
492492
func (e *Echo) Run(s engine.Server) {
493493
s.SetHandler(e)
494494
s.SetLogger(e.logger)
495+
if e.Debug() {
496+
e.logger.Debug("message=running in debug mode")
497+
}
495498
e.logger.Error(s.Start())
496499
}
497500

‎engine/standard/response.go‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ type (
2323
}
2424

2525
responseAdapter struct {
26-
writer http.ResponseWriter
27-
*Response
26+
http.ResponseWriter
27+
response *Response
2828
}
2929
)
3030

@@ -108,15 +108,23 @@ func (r *Response) reset(w http.ResponseWriter, a *responseAdapter, h engine.Hea
108108
r.writer = w
109109
}
110110

111-
func (a *responseAdapter) Header() http.Header {
112-
return a.writer.Header()
111+
func (a *responseAdapter) Write(b []byte) (n int, err error) {
112+
return a.response.Write(b)
113+
}
114+
115+
func (a *responseAdapter) Flush() {
116+
a.ResponseWriter.(http.Flusher).Flush()
117+
}
118+
119+
func (a *responseAdapter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
120+
return a.ResponseWriter.(http.Hijacker).Hijack()
113121
}
114122

115-
func (a *responseAdapter) WriteHeader(code int) {
116-
a.writer.WriteHeader(code)
123+
func (a *responseAdapter) CloseNotify() <-chan bool {
124+
return a.ResponseWriter.(http.CloseNotifier).CloseNotify()
117125
}
118126

119127
func (a *responseAdapter) reset(w http.ResponseWriter, r *Response) {
120-
a.writer = w
121-
a.Response = r
128+
a.ResponseWriter = w
129+
a.response = r
122130
}

0 commit comments

Comments
 (0)