Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
iesreza committed Sep 30, 2022
1 parent f469456 commit 3c48bb8
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions evo.context.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Request struct {
Response Response
CacheKey string
CacheDuration time.Duration
debug *bool
Debug bool
flashes []flash
}
type flash struct {
Expand Down Expand Up @@ -77,10 +77,10 @@ func (u *URL) String() string {
}

func Upgrade(ctx *fiber.Ctx) *Request {
var _false = false
r := Request{
debug: &_false,
if request := ctx.Locals("evo.request"); request != nil {
return request.(*Request)
}
r := Request{}
r.Variables = fiber.Map{}
r.Context = ctx
r.Response = Response{}
Expand All @@ -90,17 +90,10 @@ func Upgrade(ctx *fiber.Ctx) *Request {
if r.User == nil {
r.User = &User{Anonymous: true}
}
ctx.Locals("evo.request", &r)
return &r
}

func (r *Request) Debug() bool {
return *r.debug
}

func (r *Request) SetDebug(debug bool) {
r.debug = &debug
}

func (r *Request) Flash(params ...string) {
if len(params) == 0 {
return
Expand Down

0 comments on commit 3c48bb8

Please sign in to comment.