router: added middlewares
This commit is contained in:
@@ -11,6 +11,7 @@ type Context struct {
|
||||
Request *http.Request
|
||||
Writer http.ResponseWriter
|
||||
PathMap map[string]string
|
||||
StatusCode int
|
||||
}
|
||||
|
||||
func NewContext(writer http.ResponseWriter, request *http.Request) *Context {
|
||||
@@ -29,6 +30,7 @@ func (rctx *Context) SetHeader(key, value string) {
|
||||
}
|
||||
|
||||
func (rctx *Context) SetStatus(httpStatus int) {
|
||||
rctx.StatusCode = httpStatus
|
||||
rctx.Writer.WriteHeader(httpStatus)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user