diff --git a/HISTORY.md b/HISTORY.md
index 18c83a15..2ed273f6 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -2,6 +2,10 @@
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras/iris` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris`.
+## 4.2.2 -> 4.2.3
+
+- [Add IsAjax() convenience method](https://github.com/kataras/iris/issues/423)
+
## 4.2.1 -> 4.2.2
- Fix [sessiondb issue 416](https://github.com/kataras/iris/issues/416)
diff --git a/README.md b/README.md
index 5eff3c38..a93da61d 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@
-
+
@@ -178,7 +178,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
Versioning
------------
-Current: **v4.2.2**
+Current: **v4.2.3**
> Iris is an active project
@@ -221,7 +221,7 @@ License can be found [here](LICENSE).
[Travis]: http://travis-ci.org/kataras/iris
[License Widget]: https://img.shields.io/badge/license-MIT%20%20License%20-E91E63.svg?style=flat-square
[License]: https://github.com/kataras/iris/blob/master/LICENSE
-[Release Widget]: https://img.shields.io/badge/release-v4.2.2-blue.svg?style=flat-square
+[Release Widget]: https://img.shields.io/badge/release-v4.2.3-blue.svg?style=flat-square
[Release]: https://github.com/kataras/iris/releases
[Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square
[Chat]: https://kataras.rocket.chat/channel/iris
diff --git a/context.go b/context.go
index 746459df..49ac719f 100644
--- a/context.go
+++ b/context.go
@@ -277,6 +277,13 @@ func (ctx *Context) RequestHeader(k string) string {
return utils.BytesToString(ctx.RequestCtx.Request.Header.Peek(k))
}
+// IsAjax returns true if this request is an 'ajax request'( XMLHttpRequest)
+//
+// Read more at: http://www.w3schools.com/ajax/
+func IsAjax() bool {
+ return (c.RequestHeader("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest")
+}
+
// FormValueString returns a single value, as string, from post request's data
func (ctx *Context) FormValueString(name string) string {
return string(ctx.FormValue(name))
diff --git a/context/context.go b/context/context.go
index 64bbfd80..08adb093 100644
--- a/context/context.go
+++ b/context/context.go
@@ -28,6 +28,7 @@ type (
RequestIP() string
RemoteAddr() string
RequestHeader(k string) string
+ IsAjax() bool
FormValueString(string) string
FormValues(string) []string
PostValuesAll() map[string][]string
diff --git a/iris.go b/iris.go
index dacca811..91a56644 100644
--- a/iris.go
+++ b/iris.go
@@ -78,7 +78,7 @@ import (
const (
// Version of the iris
- Version = "4.2.2"
+ Version = "4.2.3"
banner = ` _____ _
|_ _| (_)