Skip to content

Commit 700a679

Browse files
committed
fix: remove extra alloc on AcquireCtx
1 parent 1b6eda4 commit 700a679

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ctx.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ type contextKey int
4242
const userContextKey contextKey = 0 // __local_user_context__
4343

4444
type DefaultCtx struct {
45-
app *App // Reference to *App
46-
route *Route // Reference to *Route
47-
req *Request // Reference to *Request
45+
app *App // Reference to *App
46+
route *Route // Reference to *Route
47+
req Request // Reference to *Request
4848
// res *Response // Reference to *Response
4949
indexRoute int // Index of the current route
5050
indexHandler int // Index of the current handler
@@ -293,7 +293,7 @@ func (c *DefaultCtx) Download(file string, filename ...string) error {
293293
// This allows you to use all fasthttp request methods
294294
// https://godoc.org/github.com/valyala/fasthttp#Req
295295
func (c *DefaultCtx) Req() *Request {
296-
return c.req
296+
return &c.req
297297
}
298298

299299
// Response return the *fasthttp.Response object

ctx_interface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ func (c *DefaultCtx) setReq(fctx *fasthttp.RequestCtx) {
502502

503503
// Attach *fasthttp.RequestCtx to ctx
504504
c.fasthttp = fctx
505-
c.req = &Request{
505+
c.req = Request{
506506
app: c.app,
507507
fasthttp: &c.fasthttp.Request,
508508
}

0 commit comments

Comments
 (0)