MCPcopy
hub / github.com/gofiber/fiber / Test_Ctx_SaveFileToStorage_DefaultBodyLimitFallback

Function Test_Ctx_SaveFileToStorage_DefaultBodyLimitFallback

ctx_test.go:5860–5878  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5858}
5859
5860func Test_Ctx_SaveFileToStorage_DefaultBodyLimitFallback(t *testing.T) {
5861 t.Parallel()
5862
5863 app := New()
5864 app.config.BodyLimit = 0 // bypass app default coercion to exercise the fallback branch
5865 storage := memory.New()
5866
5867 ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
5868 defer app.ReleaseCtx(ctx)
5869
5870 fileHeader := createMultipartFileHeader(t, "small.txt", []byte("hello"))
5871
5872 err := ctx.SaveFileToStorage(fileHeader, "key", storage)
5873 require.NoError(t, err)
5874
5875 stored, err := storage.Get("key")
5876 require.NoError(t, err)
5877 require.Equal(t, []byte("hello"), stored)
5878}
5879
5880func Test_Ctx_SaveFileToStorage_ErrorMessageContainsFilename(t *testing.T) {
5881 t.Parallel()

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
AcquireCtxMethod · 0.80
ReleaseCtxMethod · 0.80
NewFunction · 0.70
SaveFileToStorageMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected