forked from kirinlabs/HttpRequest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponse_test.go
More file actions
57 lines (42 loc) · 745 Bytes
/
Copy pathresponse_test.go
File metadata and controls
57 lines (42 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package HttpRequest
import (
"testing"
)
func TestResponse(t *testing.T) {
req := NewRequest()
resp, err := req.Get(localUrl, nil)
if err != nil {
t.Error(err)
return
}
if resp.Response() == nil {
t.Error("For Response()", "return nil")
}
}
func TestStatusCode(t *testing.T) {
req := NewRequest()
resp, err := req.Get(localUrl, nil)
if err != nil {
t.Error(err)
return
}
if resp.StatusCode() == 0 {
t.Error("For StatusCode()", "return code 0")
}
}
func TestBody(t *testing.T) {
req := NewRequest()
resp, err := req.Get(localUrl, nil)
if err != nil {
t.Error(err)
return
}
b, err := resp.Body()
if err != nil {
t.Error(err)
return
}
if b == nil {
t.Error("For Body()", "return nil")
}
}