33 lines
483 B
Go
33 lines
483 B
Go
package requests
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestGet(t *testing.T) {
|
|
resp, err := Get("http://127.0.0.1:5000/h?cc=gg", map[string]string{
|
|
"aaa": "bbb",
|
|
"ccc": "ddd",
|
|
})
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
t.Log(string(resp))
|
|
return
|
|
}
|
|
|
|
func TestPost(t *testing.T) {
|
|
resp, err := Post("http://127.0.0.1:5000/p", map[string]interface{}{
|
|
"aaa": "bbbb",
|
|
"ccc": false,
|
|
"ddd": 11,
|
|
}, Form)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
t.Log(string(resp))
|
|
return
|
|
}
|