Improved performance
This commit is contained in:
11
Context.go
11
Context.go
@ -40,17 +40,6 @@ type ctx struct {
|
||||
handlerCount int
|
||||
}
|
||||
|
||||
// newContext returns a new context from the pool.
|
||||
func newContext(req *http.Request, res http.ResponseWriter, server *Server) *ctx {
|
||||
ctx := contextPool.Get().(*ctx)
|
||||
ctx.request = req
|
||||
ctx.response = res
|
||||
ctx.server = server
|
||||
ctx.paramCount = 0
|
||||
ctx.handlerCount = 0
|
||||
return ctx
|
||||
}
|
||||
|
||||
// Bytes responds with a raw byte slice.
|
||||
func (ctx *ctx) Bytes(body []byte) error {
|
||||
_, err := ctx.response.Write(body)
|
||||
|
Reference in New Issue
Block a user