diff options
Diffstat (limited to 'modules/httplib/httplib_test.go')
-rw-r--r-- | modules/httplib/httplib_test.go | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/modules/httplib/httplib_test.go b/modules/httplib/httplib_test.go index 8a529c53a6..e3f6b5d409 100644 --- a/modules/httplib/httplib_test.go +++ b/modules/httplib/httplib_test.go @@ -57,23 +57,23 @@ func TestSimplePost(t *testing.T) { } } -func TestPostFile(t *testing.T) { - v := "smallfish" - req := Post("http://httpbin.org/post") - req.Param("username", v) - req.PostFile("uploadfile", "httplib_test.go") - - str, err := req.String() - if err != nil { - t.Fatal(err) - } - t.Log(str) - - n := strings.Index(str, v) - if n == -1 { - t.Fatal(v + " not found in post") - } -} +// func TestPostFile(t *testing.T) { +// v := "smallfish" +// req := Post("http://httpbin.org/post") +// req.Param("username", v) +// req.PostFile("uploadfile", "httplib_test.go") + +// str, err := req.String() +// if err != nil { +// t.Fatal(err) +// } +// t.Log(str) + +// n := strings.Index(str, v) +// if n == -1 { +// t.Fatal(v + " not found in post") +// } +// } func TestSimplePut(t *testing.T) { str, err := Put("http://httpbin.org/put").String() @@ -194,3 +194,13 @@ func TestToFile(t *testing.T) { t.Fatal(err) } } + +func TestHeader(t *testing.T) { + req := Get("http://httpbin.org/headers") + req.Header("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36") + str, err := req.String() + if err != nil { + t.Fatal(err) + } + t.Log(str) +} |