(t *testing.T)
| 168 | } |
| 169 | |
| 170 | func TestContextFormFileFailed(t *testing.T) { |
| 171 | buf := new(bytes.Buffer) |
| 172 | mw := multipart.NewWriter(buf) |
| 173 | mw.Close() |
| 174 | c, _ := CreateTestContext(httptest.NewRecorder()) |
| 175 | c.Request, _ = http.NewRequest(http.MethodPost, "/", nil) |
| 176 | c.Request.Header.Set("Content-Type", mw.FormDataContentType()) |
| 177 | c.engine.MaxMultipartMemory = 8 << 20 |
| 178 | f, err := c.FormFile("file") |
| 179 | require.Error(t, err) |
| 180 | assert.Nil(t, f) |
| 181 | } |
| 182 | |
| 183 | func TestContextMultipartForm(t *testing.T) { |
| 184 | buf := new(bytes.Buffer) |
nothing calls this directly
no test coverage detected