1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2017-08-24 08:27:15 -07:00
parent 6c54ff78a2
commit 57bf87258f
2 changed files with 6 additions and 1 deletions

View File

@ -295,7 +295,7 @@ func New() (e *Echo) {
func (e *Echo) NewContext(r *http.Request, w http.ResponseWriter) Context { func (e *Echo) NewContext(r *http.Request, w http.ResponseWriter) Context {
return &context{ return &context{
request: r, request: r,
response: &Response{echo: e, Writer: w}, response: NewResponse(w, e),
store: make(Map), store: make(Map),
echo: e, echo: e,
pvalues: make([]string, *e.maxParam), pvalues: make([]string, *e.maxParam),

View File

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