|
1 | 1 | package httpcall_test
|
2 | 2 |
|
3 |
| -import ( |
4 |
| - "context" |
5 |
| - "testing" |
6 |
| - "time" |
| 3 | +// import ( |
| 4 | +// "context" |
| 5 | +// "testing" |
| 6 | +// "time" |
7 | 7 |
|
8 |
| - "github.com/memory-overflow/go-common-library/httpcall" |
9 |
| - service "github.com/memory-overflow/go-common-library/task_scheduler/example/add_service" |
10 |
| -) |
| 8 | +// "github.com/memory-overflow/go-common-library/httpcall" |
| 9 | +// service "github.com/memory-overflow/go-common-library/task_scheduler/example/add_service" |
| 10 | +// ) |
11 | 11 |
|
12 |
| -func TestJsonPost(t *testing.T) { |
13 |
| - // 控制请求超时时间 |
14 |
| - ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
15 |
| - defer cancel() |
16 |
| - uri := "http://127.0.0.1:8000/add" |
17 |
| - req := &service.AddRequest{ |
18 |
| - A: 1, |
19 |
| - B: 2, |
20 |
| - } |
21 |
| - rsp := &service.AddResponse{} |
22 |
| - err := httpcall.JsonPost(ctx, uri, nil, req, rsp) |
23 |
| - if err != nil { |
24 |
| - t.Fatalf("JsonPost err: %v", err) |
25 |
| - } |
26 |
| - t.Logf("add taskId: %d", rsp.TaskId) |
27 |
| -} |
| 12 | +// func TestJsonPost(t *testing.T) { |
| 13 | +// // 控制请求超时时间 |
| 14 | +// ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
| 15 | +// defer cancel() |
| 16 | +// uri := "http://127.0.0.1:8000/add" |
| 17 | +// req := &service.AddRequest{ |
| 18 | +// A: 1, |
| 19 | +// B: 2, |
| 20 | +// } |
| 21 | +// rsp := &service.AddResponse{} |
| 22 | +// err := httpcall.JsonPost(ctx, uri, nil, req, rsp) |
| 23 | +// if err != nil { |
| 24 | +// t.Fatalf("JsonPost err: %v", err) |
| 25 | +// } |
| 26 | +// t.Logf("add taskId: %d", rsp.TaskId) |
| 27 | +// } |
0 commit comments