-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhttp_client_test.go
More file actions
53 lines (43 loc) · 1.06 KB
/
http_client_test.go
File metadata and controls
53 lines (43 loc) · 1.06 KB
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
package main
import (
"fmt"
"testing"
)
func TestHttpClient_Get(t *testing.T) {
client, err := NewHttpClient("https://www.google.com")
if err != nil {
t.Errorf("Failed to create a new client: %v", err)
return
}
result, err := client.DoPost()
if err != nil {
t.Errorf("Failed to do http get: %v", err)
}
fmt.Printf("result: %v\n", result)
}
func TestHttpClient_Get2(t *testing.T) {
addr := "https://en.wikipedia.org/wiki/Wikipedia:Community_portal"
client, err := NewHttpClient(addr)
if err != nil {
t.Errorf("Failed to create a new client: %v", err)
return
}
result, err := client.DoPost()
if err != nil {
t.Errorf("Failed to do http get: %v", err)
}
fmt.Printf("result: %v\n", result)
}
func TestHttpClient_Get3(t *testing.T) {
addr := "http://localhost:28080/memwork.php/?value=110&memory=10"
client, err := NewHttpClient(addr)
if err != nil {
t.Errorf("Failed to create a new client: %v", err)
return
}
result, err := client.DoPost()
if err != nil {
t.Errorf("Failed to do http get: %v", err)
}
fmt.Printf("result: %v\n", result)
}