-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrequest_test.go
67 lines (56 loc) · 1.52 KB
/
request_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
55
56
57
58
59
60
61
62
63
64
65
66
67
package gclient
import (
"github.com/jianzhiyao/gclient/tests"
"net/http"
"testing"
)
func TestNewRequest(t *testing.T) {
if c, err := NewRequest(http.MethodPost, tests.GetServerUrl()); c == nil || err != nil {
t.Error()
}
}
func TestNewRequestDelete(t *testing.T) {
if c, _ := NewRequestDelete(tests.GetServerUrl()); c.GetMethod() != http.MethodDelete {
t.Error()
}
}
func TestNewRequestGet(t *testing.T) {
if c, _ := NewRequestGet(tests.GetServerUrl()); c.GetMethod() != http.MethodGet {
t.Error()
}
}
func TestNewRequestHead(t *testing.T) {
if c, _ := NewRequestHead(tests.GetServerUrl()); c.GetMethod() != http.MethodHead {
t.Error()
}
}
func TestNewRequestPatch(t *testing.T) {
if c, _ := NewRequestPatch(tests.GetServerUrl()); c.GetMethod() != http.MethodPatch {
t.Error()
}
}
func TestNewRequestTrace(t *testing.T) {
if c, _ := NewRequestTrace(tests.GetServerUrl()); c.GetMethod() != http.MethodTrace {
t.Error()
}
}
func TestNewRequestPost(t *testing.T) {
if c, _ := NewRequestPost(tests.GetServerUrl()); c.GetMethod() != http.MethodPost {
t.Error(c.GetMethod())
}
}
func TestNewRequestPut(t *testing.T) {
if c, _ := NewRequestPut(tests.GetServerUrl()); c.GetMethod() != http.MethodPut {
t.Error()
}
}
func TestNewRequestConnect(t *testing.T) {
if c, _ := NewRequestConnect(tests.GetServerUrl()); c.GetMethod() != http.MethodConnect {
t.Error()
}
}
func TestNewRequestOptions(t *testing.T) {
if c, _ := NewRequestOptions(tests.GetServerUrl()); c.GetMethod() != http.MethodOptions {
t.Error()
}
}