|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package gorequest
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -8,7 +9,7 @@ func TestGet(t *testing.T) {
|
|
|
|
|
appHttp := NewHttp()
|
|
|
|
|
appHttp.SetDebug()
|
|
|
|
|
//appHttp.SetUri("https://api.dtapp.net/ip")
|
|
|
|
|
get, err := appHttp.Get("https://api.dtapp.net/ip")
|
|
|
|
|
get, err := appHttp.Get(context.Background(), "https://api.dtapp.net/ip")
|
|
|
|
|
|
|
|
|
|
t.Logf("get:%+v\n", get)
|
|
|
|
|
t.Logf("get.ResponseBody:%s\n", get.ResponseBody)
|
|
|
|
@ -18,7 +19,7 @@ func TestGet(t *testing.T) {
|
|
|
|
|
func TestPost(t *testing.T) {
|
|
|
|
|
appHttp := NewHttp()
|
|
|
|
|
appHttp.SetUri("https://api.dtapp.net/ip")
|
|
|
|
|
get, err := appHttp.Post()
|
|
|
|
|
get, err := appHttp.Post(context.Background())
|
|
|
|
|
|
|
|
|
|
t.Logf("get:%+v\n", get)
|
|
|
|
|
t.Logf("get.ResponseBody:%s\n", get.ResponseBody)
|
|
|
|
|