Former-commit-id: f8560514a7b48f83121ddd21d74b4016af4e1b67
This commit is contained in:
Gerasimos Maropoulos 2018-03-08 20:55:58 +02:00
parent 83c4b7f52d
commit 1165b4527a
4 changed files with 13 additions and 6 deletions

View File

@ -30,7 +30,7 @@ func TestConfigurationStatic(t *testing.T) {
afterNew = *app.config
if app.config.DisableBodyConsumptionOnUnmarshal == false {
if !app.config.DisableBodyConsumptionOnUnmarshal {
t.Fatalf("Passing a Configuration field as Option fails, expected DisableBodyConsumptionOnUnmarshal to be true but was false")
}

View File

@ -172,6 +172,14 @@ func (h *routerHandler) HandleRequest(ctx context.Context) {
r.URL.Path = path
url := r.URL.String()
// Fixes https://github.com/kataras/iris/issues/921
// This is caused for security reasons, imagine a payment shop,
// you can't just permantly redirect a POST request, so just 307 (RFC 7231, 6.4.7).
if method == http.MethodPost || method == http.MethodPut {
ctx.Redirect(url, http.StatusTemporaryRedirect)
return
}
ctx.Redirect(url, http.StatusMovedPermanently)
// RFC2616 recommends that a short note "SHOULD" be included in the

View File

@ -128,10 +128,9 @@ func (r *Service) GetBytes(key string) ([]byte, error) {
func (r *Service) Delete(key string) error {
c := r.pool.Get()
defer c.Close()
if _, err := c.Do("DEL", r.Config.Prefix+key); err != nil {
return err
}
return nil
_, err := c.Do("DEL", r.Config.Prefix+key)
return err
}
func dial(network string, addr string, pass string) (redis.Conn, error) {

View File

@ -128,7 +128,7 @@ func (s *HandlebarsEngine) loadDirectory() error {
// instead of the html/template engine which works like {{ render "myfile.html"}} and accepts the parent binding, with handlebars we can't do that because of lack of runtime helpers (dublicate error)
var templateErr error
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
filepath.Walk(dir, func(path string, info os.FileInfo, _ error) error {
if info == nil || info.IsDir() {
return nil
}