diff --git a/controller.go b/controller.go index d8228c78..c3caa2a4 100644 --- a/controller.go +++ b/controller.go @@ -262,15 +262,15 @@ func (c *Controller) GetString(key string) string { } func (c *Controller) GetStrings(key string) []string { - r := c.Ctx.Request; - if r.Form == nil { + r := c.Ctx.Request + if r.Form == nil { return []string{} } - vs := r.Form[key] - if len(vs) > 0 { - return vs - } - return []string{} + vs := r.Form[key] + if len(vs) > 0 { + return vs + } + return []string{} } func (c *Controller) GetInt(key string) (int64, error) { @@ -327,3 +327,7 @@ func (c *Controller) DelSession(name interface{}) { } c.CruSession.Delete(name) } + +func (c *Controller) IsAjax() bool { + return (c.Ctx.Request.Header.Get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest") +}