mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2024-11-22 20:56:02 +03:00
test http post
This commit is contained in:
parent
c985cedb66
commit
52811552c6
@ -26,11 +26,11 @@ func TestUploadFormFile(t *testing.T) {
|
|||||||
body := new(bytes.Buffer)
|
body := new(bytes.Buffer)
|
||||||
//body := &bytes.Buffer{}
|
//body := &bytes.Buffer{}
|
||||||
writer := multipart.NewWriter(body)
|
writer := multipart.NewWriter(body)
|
||||||
formFile, err := writer.CreateFormFile("file", filepath.Base(filePath))
|
formFileWriter, err := writer.CreateFormFile("file", filepath.Base(filePath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if _, err = io.Copy(formFile, bytes.NewReader(yamlFile)); err != nil {
|
if _, err = io.Copy(formFileWriter, bytes.NewReader(yamlFile)); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
writer.Close()
|
writer.Close()
|
||||||
|
Loading…
Reference in New Issue
Block a user