diff --git a/.travis.yml b/.travis.yml index d385a064..7e4d3bf0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,10 @@ install: # - go get -v github.com/axw/gocov # - go install github.com/axw/gocov/gocov script: - # - gocov test | gocov report # the result is invalid because it tests the vendor too, which are removed to reduce the dl size. + # - gocov test | gocov report + # the result of gocov is invalid because it tests the vendor too, + # which its tests are removed to reduce the dl size. + # When I'll push my internal tests to github I'll do it + # to do the test coverage all folders except vendor. + # For now keep it commented. - go test -v ./... \ No newline at end of file diff --git a/HISTORY.md b/HISTORY.md index 1666ed21..b2c93389 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -29,6 +29,18 @@ Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.co The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please! +# Sa, 10 June 2017 | v7.0.3 + +- New `context.Session().PeekFlash("key")` added, unlike `GetFlash` this will return the flash value but keep the message valid for the next requests too. +- Complete the [httptest example](https://github.com/iris-contrib/examples/tree/master/httptest). +- Fix the (marked as deprecated) `ListenLETSENCRYPT` function. +- Upgrade the [iris-contrib/middleware](https://github.com/iris-contrib/middleware) including JWT, CORS and Secure handlers. +- Add [OAuth2 example](https://github.com/iris-contrib/examples/tree/master/oauth2) -- showcases the third-party package [goth](https://github.com/markbates/goth) integration with Iris. + +### Community + + - Add github integration on https://kataras.rocket.chat/channel/iris , so users can login with their github accounts instead of creating new for the chat only. + # Th, 08 June 2017 | v7.0.2 - Able to set **immutable** data on sessions and context's storage. Aligned to fix an issue on slices and maps as reported [here](https://github.com/iris-contrib/community-board/issues/5). diff --git a/README.md b/README.md index def88d57..00f4d6ec 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A fast, cross-platform and efficient web framework with robust set of well-desig [![Report card](https://img.shields.io/badge/report%20card%20-a%2B-F44336.svg?style=flat-square)](http://goreportcard.com/report/kataras/iris) [![Support forum](https://img.shields.io/badge/support-page-ec2eb4.svg?style=flat-square)](http://support.iris-go.com) [![Examples](https://img.shields.io/badge/howto-examples-3362c2.svg?style=flat-square)](https://github.com/kataras/iris/tree/master/_examples#table-of-contents) -[![Godocs](https://img.shields.io/badge/7.0.2-%20documentation-5272B4.svg?style=flat-square)](https://godoc.org/github.com/kataras/iris) +[![Godocs](https://img.shields.io/badge/7.0.3-%20documentation-5272B4.svg?style=flat-square)](https://godoc.org/github.com/kataras/iris) [![Chat](https://img.shields.io/badge/community-%20chat-00BCD4.svg?style=flat-square)](https://kataras.rocket.chat/channel/iris) [![Buy me a cup of coffee](https://img.shields.io/badge/support-%20open--source-F4A460.svg?logo=data:image%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiPjxwYXRoIGZpbGw9InJnYigyMjAsMjIwLDIyMCkiIGQ9Ik04ODYuNiwzMDUuM2MtNDUuNywyMDMuMS0xODcsMzEwLjMtNDA5LjYsMzEwLjNoLTc0LjFsLTUxLjUsMzI2LjloLTYybC0zLjIsMjEuMWMtMi4xLDE0LDguNiwyNi40LDIyLjYsMjYuNGgxNTguNWMxOC44LDAsMzQuNy0xMy42LDM3LjctMzIuMmwxLjUtOGwyOS45LTE4OS4zbDEuOS0xMC4zYzIuOS0xOC42LDE4LjktMzIuMiwzNy43LTMyLjJoMjMuNWMxNTMuNSwwLDI3My43LTYyLjQsMzA4LjktMjQyLjdDOTIxLjYsNDA2LjgsOTE2LjcsMzQ4LjYsODg2LjYsMzA1LjN6Ii8%2BPHBhdGggZmlsbD0icmdiKDIyMCwyMjAsMjIwKSIgZD0iTTc5MS45LDgzLjlDNzQ2LjUsMzIuMiw2NjQuNCwxMCw1NTkuNSwxMEgyNTVjLTIxLjQsMC0zOS44LDE1LjUtNDMuMSwzNi44TDg1LDg1MWMtMi41LDE1LjksOS44LDMwLjIsMjUuOCwzMC4ySDI5OWw0Ny4zLTI5OS42bC0xLjUsOS40YzMuMi0yMS4zLDIxLjQtMzYuOCw0Mi45LTM2LjhINDc3YzE3NS41LDAsMzEzLTcxLjIsMzUzLjItMjc3LjVjMS4yLTYuMSwyLjMtMTIuMSwzLjEtMTcuOEM4NDUuMSwxODIuOCw4MzMuMiwxMzAuOCw3OTEuOSw4My45TDc5MS45LDgzLjl6Ii8%2BPC9zdmc%2B)](https://github.com/kataras/iris#buy-me-a-cup-of-coffee) @@ -394,7 +394,7 @@ Besides the fact that we have a [community chat][Chat] for questions or reports Version ------------ -Current: v7.0.2 +Current: **7.0.3** Each new release is pushed to the master. It stays there until the next version. When a next version is released then the previous version goes to its own branch with `gopkg.in` as its import path (and its own vendor folder), in order to keep it working "for-ever". diff --git a/iris.go b/iris.go index 9bc81766..bd6589c8 100644 --- a/iris.go +++ b/iris.go @@ -41,7 +41,7 @@ const ( // Version is the current version number of the Iris Web framework. // // Look https://github.com/kataras/iris#where-can-i-find-older-versions for older versions. - Version = "7.0.2" + Version = "7.0.3" ) const ( diff --git a/sessions/session.go b/sessions/session.go index 8292c0cb..7c42c070 100644 --- a/sessions/session.go +++ b/sessions/session.go @@ -71,23 +71,43 @@ func (s *session) HasFlash() bool { return len(s.flashes) > 0 } -// GetFlash returns a flash message which removed on the next request +// GetFlash returns a stored flash message based on its "key" +// which will be removed on the next request. // // To check for flash messages we use the HasFlash() Method // and to obtain the flash message we use the GetFlash() Method. // There is also a method GetFlashes() to fetch all the messages. // // Fetching a message deletes it from the session. -// This means that a message is meant to be displayed only on the first page served to the user -func (s *session) GetFlash(key string) (v interface{}) { +// This means that a message is meant to be displayed only on the first page served to the user. +func (s *session) GetFlash(key string) interface{} { + fv, ok := s.peekFlashMessage(key) + if !ok { + return nil + } + fv.shouldRemove = true + return fv.value +} + +// PeekFlash returns a stored flash message based on its "key". +// Unlike GetFlash, this will keep the message valid for the next requests, +// until GetFlashes or GetFlash("key"). +func (s *session) PeekFlash(key string) interface{} { + fv, ok := s.peekFlashMessage(key) + if !ok { + return nil + } + return fv.value +} + +func (s *session) peekFlashMessage(key string) (*flashMessage, bool) { s.mu.Lock() - if valueStorage, found := s.flashes[key]; found { - valueStorage.shouldRemove = true - v = valueStorage.value + if fv, found := s.flashes[key]; found { + return fv, true } s.mu.Unlock() - return + return nil, false } // GetString same as Get but returns as string, if nil then returns an empty string