Skip to content

Commit

Permalink
fix: remove extra alloc on AcquireCtx
Browse files Browse the repository at this point in the history
  • Loading branch information
nickajacks1 committed Mar 9, 2024
1 parent 2ecb876 commit 804eade
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ type contextKey int
const userContextKey contextKey = 0 // __local_user_context__

type DefaultCtx struct {
app *App // Reference to *App
route *Route // Reference to *Route
req *Request // Reference to *Request
app *App // Reference to *App
route *Route // Reference to *Route
req Request // Reference to *Request
// res *Response // Reference to *Response
indexRoute int // Index of the current route
indexHandler int // Index of the current handler
Expand Down Expand Up @@ -293,7 +293,7 @@ func (c *DefaultCtx) Download(file string, filename ...string) error {
// This allows you to use all fasthttp request methods
// https://godoc.org/github.com/valyala/fasthttp#Req
func (c *DefaultCtx) Req() *Request {
return c.req
return &c.req
}

// Response return the *fasthttp.Response object
Expand Down
2 changes: 1 addition & 1 deletion ctx_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ func (c *DefaultCtx) setReq(fctx *fasthttp.RequestCtx) {

// Attach *fasthttp.RequestCtx to ctx
c.fasthttp = fctx
c.req = &Request{
c.req = Request{
app: c.app,
fasthttp: &c.fasthttp.Request,
}
Expand Down

0 comments on commit 804eade

Please sign in to comment.