(t *testing.T)
| 554 | } |
| 555 | |
| 556 | func createFormFilesMultipartRequestFail(t *testing.T) *http.Request { |
| 557 | boundary := "--testboundary" |
| 558 | body := new(bytes.Buffer) |
| 559 | mw := multipart.NewWriter(body) |
| 560 | defer mw.Close() |
| 561 | |
| 562 | require.NoError(t, mw.SetBoundary(boundary)) |
| 563 | require.NoError(t, mw.WriteField("foo", "bar")) |
| 564 | require.NoError(t, mw.WriteField("bar", "foo")) |
| 565 | |
| 566 | f, err := os.Open("form.go") |
| 567 | require.NoError(t, err) |
| 568 | defer f.Close() |
| 569 | fw, err1 := mw.CreateFormFile("file_foo", "form_foo.go") |
| 570 | require.NoError(t, err1) |
| 571 | _, err = io.Copy(fw, f) |
| 572 | require.NoError(t, err) |
| 573 | |
| 574 | req, err2 := http.NewRequest(http.MethodPost, "/?foo=getfoo&bar=getbar", body) |
| 575 | require.NoError(t, err2) |
| 576 | req.Header.Set("Content-Type", MIMEMultipartPOSTForm+"; boundary="+boundary) |
| 577 | |
| 578 | return req |
| 579 | } |
| 580 | |
| 581 | func createFormMultipartRequest(t *testing.T) *http.Request { |
| 582 | boundary := "--testboundary" |
no test coverage detected