httplib:support file upload

This commit is contained in:
astaxie
2014-05-08 16:58:08 +08:00
parent dce09837b9
commit 14688f240f
3 changed files with 69 additions and 7 deletions

View File

@@ -7,6 +7,7 @@
package httplib
import (
"fmt"
"io/ioutil"
"testing"
)
@@ -36,3 +37,15 @@ func TestGetUrl(t *testing.T) {
t.Fatal("has no info")
}
}
func TestPost(t *testing.T) {
b := Post("http://beego.me/").Debug(true)
b.Param("username", "astaxie")
b.Param("password", "hello")
b.PostFile("uploadfile", "httplib.go")
str, err := b.String()
if err != nil {
t.Fatal(err)
}
fmt.Println(str)
}