Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
make the Flash#Persist function private
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Feb 3, 2017
1 parent 2081bbd commit 621e454
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions default_context.go
Expand Up @@ -141,7 +141,7 @@ func (d *DefaultContext) Render(status int, rr render.Renderer) error {


if d.Session() != nil { if d.Session() != nil {
d.Flash().Clear() d.Flash().Clear()
d.Flash().Persist(d.Session()) d.Flash().persist(d.Session())
} }


d.Response().Header().Set("Content-Type", rr.ContentType()) d.Response().Header().Set("Content-Type", rr.ContentType())
Expand Down Expand Up @@ -206,7 +206,7 @@ func (d *DefaultContext) Websocket() (*websocket.Conn, error) {


// Redirect a request with the given status to the given URL. // Redirect a request with the given status to the given URL.
func (d *DefaultContext) Redirect(status int, url string, args ...interface{}) error { func (d *DefaultContext) Redirect(status int, url string, args ...interface{}) error {
d.Flash().Persist(d.Session()) d.Flash().persist(d.Session())


http.Redirect(d.Response(), d.Request(), fmt.Sprintf(url, args...), status) http.Redirect(d.Response(), d.Request(), fmt.Sprintf(url, args...), status)
return nil return nil
Expand Down
2 changes: 1 addition & 1 deletion flash.go
Expand Up @@ -36,7 +36,7 @@ func (f Flash) Add(key, value string) {
} }


//Persist the flash inside the session. //Persist the flash inside the session.
func (f Flash) Persist(session *Session) { func (f Flash) persist(session *Session) {
b, _ := json.Marshal(f.data) b, _ := json.Marshal(f.data)
session.Set(flashKey, b) session.Set(flashKey, b)
session.Save() session.Save()
Expand Down
2 changes: 1 addition & 1 deletion handler.go
Expand Up @@ -58,7 +58,7 @@ func (a *App) handlerToHandler(info RouteInfo, h Handler) http.Handler {
hf := func(res http.ResponseWriter, req *http.Request) { hf := func(res http.ResponseWriter, req *http.Request) {
c := a.newContext(info, res, req) c := a.newContext(info, res, req)


defer c.Flash().Persist(c.Session()) defer c.Flash().persist(c.Session())


err := a.Middleware.handler(h)(c) err := a.Middleware.handler(h)(c)


Expand Down

0 comments on commit 621e454

Please sign in to comment.