mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2025-04-05 06:03:37 +03:00
test http post
This commit is contained in:
parent
c985cedb66
commit
52811552c6
1 changed files with 2 additions and 2 deletions
|
@ -26,11 +26,11 @@ func TestUploadFormFile(t *testing.T) {
|
|||
body := new(bytes.Buffer)
|
||||
//body := &bytes.Buffer{}
|
||||
writer := multipart.NewWriter(body)
|
||||
formFile, err := writer.CreateFormFile("file", filepath.Base(filePath))
|
||||
formFileWriter, err := writer.CreateFormFile("file", filepath.Base(filePath))
|
||||
if err != nil {
|
||||
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)
|
||||
}
|
||||
writer.Close()
|
||||
|
|
Loading…
Add table
Reference in a new issue