github.com/rjeczalik/buffalo@v0.11.1/method_override_test.go (about) 1 package buffalo 2 3 import ( 4 "net/url" 5 "testing" 6 7 "github.com/gobuffalo/buffalo/render" 8 "github.com/markbates/willie" 9 "github.com/stretchr/testify/require" 10 ) 11 12 func Test_MethodOverride(t *testing.T) { 13 r := require.New(t) 14 15 a := New(Options{}) 16 a.PUT("/", func(c Context) error { 17 return c.Render(200, render.String("you put me!")) 18 }) 19 20 w := willie.New(a) 21 res := w.Request("/").Post(url.Values{"_method": []string{"PUT"}}) 22 r.Equal(200, res.Code) 23 r.Equal("you put me!", res.Body.String()) 24 }