-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathresponse_test.go
54 lines (42 loc) · 930 Bytes
/
response_test.go
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
package gohttp
import "testing"
// TestGetRespResponse tests GetResp response
func TestGetRespResponse(t *testing.T) {
t.Log("(GetResp expected value)")
req := NewRequest()
resp, err := req.Query(map[string]string{"q": "hello"}).Get("http://httpbin.org/get")
if err != nil {
t.Error(err)
}
if resp.GetResp() == nil {
t.Error(
"For", "GetResp",
"expected", "value",
"got", "nill | err",
)
}
}
// TestGetRespResponse tests GetResp response
func TestGetBodyResponse(t *testing.T) {
t.Log("(GetBody expected value)")
res0 := &Response{}
if res0.GetBody() != nil {
t.Error(
"For", "GetBody",
"expected", "nil",
"got", "value",
)
}
req := NewRequest()
resp, err := req.Query(map[string]string{"q": "hello"}).Get("http://httpbin.org/get")
if err != nil {
t.Error(err)
}
if resp.GetBody() == nil {
t.Error(
"For", "GetBody",
"expected", "value",
"got", "nil",
)
}
}