Compare commits

..

2 Commits

Author SHA1 Message Date
goingforstudying-ctrl
2a93f82e57
Merge 30a1dadcb0ae02dbfe894ab8c78b8ec22b79b694 into d9307dbcbbe796a64d9e0ef23452da888dd7f904 2026-06-22 17:09:03 +00:00
goingforstudying-ctrl
30a1dadcb0 feat: add SkipMethodNotAllowedMiddleware option
Adds a new Engine option that, when enabled, prevents global middleware
registered via Use() from being executed for 405 Method Not Allowed
responses. This allows NoMethod handlers to run without triggering
middleware that may reject the request (e.g., authentication, checksum
validation) before the 405 response can be sent.

Fixes gin-gonic/gin#4189
2026-06-22 13:08:57 -04:00

View File

@ -271,14 +271,7 @@ func TestSaveUploadedFileWithPermissionFailed(t *testing.T) {
assert.Equal(t, "permission_test", f.Filename)
var mode fs.FileMode = 0o644
dst := filepath.Join(t.TempDir(), "test", "permission_test")
// The fix in #4702 only chmods the directory when it is newly created.
// When running as root, chmod on any directory succeeds, so this test
// cannot reliably assert failure. Instead, verify that the directory
// is created with the requested mode and the file is written correctly.
require.NoError(t, c.SaveUploadedFile(f, dst, mode))
info, err := os.Stat(filepath.Dir(dst))
require.NoError(t, err)
assert.Equal(t, mode, info.Mode().Perm())
require.Error(t, c.SaveUploadedFile(f, dst, mode))
}
// TestSaveUploadedFileToExistingDir is a regression test for issue #4622.