From 04cdefb2a6dc7f400d4bb77ac5690a768a7a65a1 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Fri, 8 May 2015 11:21:50 -0700 Subject: [PATCH] Fixed #51 Signed-off-by: Vishal Rana --- context.go | 2 +- context_test.go | 2 +- echo.go | 2 +- response.go | 14 +++++++------- response_test.go | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/context.go b/context.go index b25dbdb4..09c7e968 100644 --- a/context.go +++ b/context.go @@ -10,7 +10,7 @@ type ( // response references, path parameters, data and registered handler. Context struct { Request *http.Request - Response *response + Response *Response pnames []string pvalues []string store store diff --git a/context_test.go b/context_test.go index 0ced8ecb..03977d32 100644 --- a/context_test.go +++ b/context_test.go @@ -27,7 +27,7 @@ func TestContext(t *testing.T) { b, _ := json.Marshal(u1) r, _ := http.NewRequest(POST, "/users/1", bytes.NewReader(b)) c := &Context{ - Response: &response{Writer: httptest.NewRecorder()}, + Response: &Response{Writer: httptest.NewRecorder()}, Request: r, pvalues: make([]string, 5), store: make(store), diff --git a/echo.go b/echo.go index 9d7f2133..8c286490 100644 --- a/echo.go +++ b/echo.go @@ -114,7 +114,7 @@ func New() (e *Echo) { e.Router = NewRouter(e) e.pool.New = func() interface{} { return &Context{ - Response: &response{}, + Response: &Response{}, pnames: make([]string, e.maxParam), pvalues: make([]string, e.maxParam), store: make(store), diff --git a/response.go b/response.go index a07aeaaa..0e446bf9 100644 --- a/response.go +++ b/response.go @@ -8,7 +8,7 @@ import ( ) type ( - response struct { + Response struct { Writer http.ResponseWriter status int size int @@ -16,11 +16,11 @@ type ( } ) -func (r *response) Header() http.Header { +func (r *Response) Header() http.Header { return r.Writer.Header() } -func (r *response) WriteHeader(n int) { +func (r *Response) WriteHeader(n int) { if r.committed { // TODO: Warning log.Printf("echo: %s", color.Yellow("response already committed")) @@ -31,21 +31,21 @@ func (r *response) WriteHeader(n int) { r.committed = true } -func (r *response) Write(b []byte) (n int, err error) { +func (r *Response) Write(b []byte) (n int, err error) { n, err = r.Writer.Write(b) r.size += n return n, err } -func (r *response) Status() int { +func (r *Response) Status() int { return r.status } -func (r *response) Size() int { +func (r *Response) Size() int { return r.size } -func (r *response) reset(w http.ResponseWriter) { +func (r *Response) reset(w http.ResponseWriter) { r.Writer = w r.committed = false } diff --git a/response_test.go b/response_test.go index fce5e977..a21f9414 100644 --- a/response_test.go +++ b/response_test.go @@ -7,7 +7,7 @@ import ( ) func TestResponse(t *testing.T) { - r := &response{Writer: httptest.NewRecorder()} + r := &Response{Writer: httptest.NewRecorder()} // Header if r.Header() == nil {