Skip to content

Commit 57bf872

Browse files
committed
Fixed #995
Signed-off-by: Vishal Rana <[email protected]>
1 parent 6c54ff7 commit 57bf872

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

echo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func New() (e *Echo) {
295295
func (e *Echo) NewContext(r *http.Request, w http.ResponseWriter) Context {
296296
return &context{
297297
request: r,
298-
response: &Response{echo: e, Writer: w},
298+
response: NewResponse(w, e),
299299
store: make(Map),
300300
echo: e,
301301
pvalues: make([]string, *e.maxParam),

response.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ type (
2020
}
2121
)
2222

23+
// NewResponse creates a new instance of Response.
24+
func NewResponse(w http.ResponseWriter, e *Echo) (r *Response) {
25+
return &Response{Writer: w, echo: e}
26+
}
27+
2328
// Header returns the header map for the writer that will be sent by
2429
// WriteHeader. Changing the header after a call to WriteHeader (or Write) has
2530
// no effect unless the modified headers were declared as trailers by setting

0 commit comments

Comments
 (0)