Browse Source

add SetRequest for Context (#53)

tags/v0.6.0
Lunny Xiao GitHub 7 months ago
parent
commit
eff25c79c1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      context.go

+ 5
- 0
context.go View File

@@ -64,6 +64,11 @@ func (ctx *Context) Req() *http.Request {
return ctx.req
}

// SetRequest sets the request to context
func (ctx *Context) SetRequest(req *http.Request) {
ctx.req = req
}

// IsAjax returns if the request is an ajax request
func (ctx *Context) IsAjax() bool {
return ctx.Req().Header.Get("X-Requested-With") == "XMLHttpRequest"


Loading…
Cancel
Save