(t *testing.T)
| 478 | } |
| 479 | |
| 480 | func Test_App_BodyLimit_Zero(t *testing.T) { |
| 481 | t.Parallel() |
| 482 | |
| 483 | app := New(Config{BodyLimit: 0}) |
| 484 | |
| 485 | app.Post("/", func(c Ctx) error { |
| 486 | return c.SendStatus(StatusOK) |
| 487 | }) |
| 488 | |
| 489 | largeBody := bytes.Repeat([]byte{'a'}, DefaultBodyLimit+1) |
| 490 | req := httptest.NewRequest(MethodPost, "/", bytes.NewReader(largeBody)) |
| 491 | _, err := app.Test(req) |
| 492 | require.ErrorIs(t, err, fasthttp.ErrBodyTooLarge) |
| 493 | |
| 494 | smallBody := bytes.Repeat([]byte{'a'}, DefaultBodyLimit-1) |
| 495 | req = httptest.NewRequest(MethodPost, "/", bytes.NewReader(smallBody)) |
| 496 | resp, err := app.Test(req) |
| 497 | require.NoError(t, err) |
| 498 | require.Equal(t, StatusOK, resp.StatusCode) |
| 499 | } |
| 500 | |
| 501 | func Test_App_BodyLimit_LargerThanDefault(t *testing.T) { |
| 502 | t.Parallel() |
nothing calls this directly
no test coverage detected