diff options
author | Unknown <joe2010xtmf@163.com> | 2014-05-06 11:50:31 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-05-06 11:50:31 -0400 |
commit | e573855a4f040abd4aa6a2afa9ce610a1ec2670f (patch) | |
tree | 7ead7dafd3c228305e83a19dec0bca5b60d92217 /modules/httplib/httplib_test.go | |
parent | 94bccbb148a4ed897eb8332fc746aa75486c5c4d (diff) |
Fix #98, support web hook
Diffstat (limited to 'modules/httplib/httplib_test.go')
-rwxr-xr-x | modules/httplib/httplib_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/httplib/httplib_test.go b/modules/httplib/httplib_test.go new file mode 100755 index 00000000..cc56dd88 --- /dev/null +++ b/modules/httplib/httplib_test.go @@ -0,0 +1,32 @@ +package httplib + +import ( + "io/ioutil" + "testing" +) + +func TestGetUrl(t *testing.T) { + resp, err := Get("http://beego.me/").Debug(true).Response() + if err != nil { + t.Fatal(err) + } + if resp.Body == nil { + t.Fatal("body is nil") + } + data, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + t.Fatal(err) + } + if len(data) == 0 { + t.Fatal("data is no") + } + + str, err := Get("http://beego.me/").String() + if err != nil { + t.Fatal(err) + } + if len(str) == 0 { + t.Fatal("has no info") + } +} |