(t *testing.T)
| 5628 | } |
| 5629 | |
| 5630 | func Test_Ctx_SaveFileToStorage_LimitExceededUnknownSize(t *testing.T) { |
| 5631 | t.Parallel() |
| 5632 | const ( |
| 5633 | allowedSize = 1024 |
| 5634 | fileSize = allowedSize + 256 |
| 5635 | ) |
| 5636 | |
| 5637 | app := New(Config{BodyLimit: allowedSize}) |
| 5638 | |
| 5639 | storage := memory.New() |
| 5640 | ctx := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 5641 | |
| 5642 | t.Cleanup(func() { |
| 5643 | app.ReleaseCtx(ctx) |
| 5644 | }) |
| 5645 | |
| 5646 | fileHeader := createMultipartFileHeader(t, "unknown-size.bin", bytes.Repeat([]byte{'a'}, fileSize)) |
| 5647 | fileHeader.Size = -1 |
| 5648 | |
| 5649 | err := ctx.SaveFileToStorage(fileHeader, "test", storage) |
| 5650 | require.ErrorIs(t, err, fasthttp.ErrBodyTooLarge) |
| 5651 | } |
| 5652 | |
| 5653 | type captureStorage struct { |
| 5654 | t *testing.T |
nothing calls this directly
no test coverage detected