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

Commit

Permalink
Merge pull request #2217 from gobuffalo/development
Browse files Browse the repository at this point in the history
v0.18.4
  • Loading branch information
paganotoni authored Mar 8, 2022
2 parents c9873bd + f301d06 commit f63f199
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- "ubuntu-latest"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
Expand Down
1 change: 0 additions & 1 deletion default_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ var mapType = reflect.ValueOf(map[string]interface{}{}).Type()
// Redirect a request with the given status to the given URL.
func (d *DefaultContext) Redirect(status int, url string, args ...interface{}) error {
if d.Session() != nil {
d.Flash().Clear()
d.Flash().persist(d.Session())
if err := d.Session().Save(); err != nil {
return HTTPError{Status: http.StatusInternalServerError, Cause: err}
Expand Down
2 changes: 1 addition & 1 deletion error_templates.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package buffalo

import (
_ "embed"
_ "embed" // needed to embed the templates.
)

var (
Expand Down
29 changes: 28 additions & 1 deletion flash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package buffalo
import (
"net/http"
"testing"
"text/template"

"github.com/gobuffalo/buffalo/render"
"github.com/gobuffalo/httptest"
Expand Down Expand Up @@ -120,4 +121,30 @@ func Test_FlashRenderCustomKeyNotDefined(t *testing.T) {
const customKeyTPL = `
{{#each flash.other as |k value|}}
{{value}}
{{/each}}`
{{/each}}
`

func Test_FlashNotClearedOnRedirect(t *testing.T) {
r := require.New(t)
a := New(Options{})
rr := render.New(render.Options{})

a.GET("/flash", func(c Context) error {
c.Flash().Add("success", "Antonio, you're welcome!")
return c.Redirect(http.StatusSeeOther, "/")
})

a.GET("/", func(c Context) error {
template := `Message: <%= flash["success"] %>`
return c.Render(http.StatusCreated, rr.String(template))
})

w := httptest.New(a)
res := w.HTML("/flash").Get()
r.Equal(res.Code, http.StatusSeeOther)
r.Equal(res.Location(), "/")

res = w.HTML("/").Get()
r.Contains(res.Body.String(), template.HTMLEscapeString("Antonio, you're welcome!"))

}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/gobuffalo/buffalo
go 1.16

require (
github.com/BurntSushi/toml v0.4.1
github.com/BurntSushi/toml v1.0.0
github.com/dustin/go-humanize v1.0.0
github.com/fatih/color v1.13.0
github.com/gobuffalo/envy v1.10.1
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
Expand Down
2 changes: 1 addition & 1 deletion runtime/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package runtime

// Version is the current version of the buffalo binary
var Version = "v0.18.3"
var Version = "v0.18.4"

0 comments on commit f63f199

Please sign in to comment.