Gerasimos Maropoulos 2016-09-15 18:59:27 +03:00
parent 7ea334812f
commit 741ecbf2fb
5 changed files with 16 additions and 4 deletions

View File

@ -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)

View File

@ -18,7 +18,7 @@
<br/>
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%204.2.2%20-blue.svg?style=flat-square" alt="Releases"></a>
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%204.2.3%20-blue.svg?style=flat-square" alt="Releases"></a>
<a href="https://github.com/iris-contrib/examples"><img src="https://img.shields.io/badge/%20examples-repository-3362c2.svg?style=flat-square" alt="Examples"></a>
@ -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

View File

@ -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))

View File

@ -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

View File

@ -78,7 +78,7 @@ import (
const (
// Version of the iris
Version = "4.2.2"
Version = "4.2.3"
banner = ` _____ _
|_ _| (_)