| 2808 | } |
| 2809 | |
| 2810 | func Test_App_ReadBodyStream(t *testing.T) { |
| 2811 | t.Parallel() |
| 2812 | app := New(Config{StreamRequestBody: true}) |
| 2813 | app.Post("/", func(c Ctx) error { |
| 2814 | // Calling c.Body() automatically reads the entire stream. |
| 2815 | return c.SendString(fmt.Sprintf("%v %s", c.Request().IsBodyStream(), c.Body())) |
| 2816 | }) |
| 2817 | testString := "this is a test" |
| 2818 | resp, err := app.Test(httptest.NewRequest(MethodPost, "/", bytes.NewBufferString(testString))) |
| 2819 | require.NoError(t, err, "app.Test(req)") |
| 2820 | body, err := io.ReadAll(resp.Body) |
| 2821 | require.NoError(t, err, "io.ReadAll(resp.Body)") |
| 2822 | require.Equal(t, "true "+testString, string(body)) |
| 2823 | } |
| 2824 | |
| 2825 | func Test_App_DisablePreParseMultipartForm(t *testing.T) { |
| 2826 | t.Parallel() |