This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
middleware.SessionSaver is now built-in.
- Loading branch information
Showing
6 changed files
with
24 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
package middleware | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gobuffalo/buffalo" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
// SessionSaver will automatically save a session if the | ||
// request was successful. | ||
// SessionSaver is deprecated, and will be removed in v0.10.0. This now happens automatically. This middleware is no longer required. | ||
func SessionSaver(next buffalo.Handler) buffalo.Handler { | ||
return func(c buffalo.Context) error { | ||
err := next(c) | ||
if err != nil { | ||
return errors.WithStack(err) | ||
} | ||
return c.Session().Save() | ||
warningMsg := "SessionSaver is deprecated, and will be removed in v0.10.0. This now happens automatically. This middleware is no longer required." | ||
fmt.Println(warningMsg) | ||
return next(c) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters