MCPcopy Index your code
hub / github.com/imroc/req / TestSendMethods

Function TestSendMethods

request_test.go:85–149  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func TestSendMethods(t *testing.T) {
86 c := tc()
87 testCases := []struct {
88 SendReq func(req *Request) (resp *Response, err error)
89 ExpectMethod string
90 }{
91 {
92 SendReq: func(req *Request) (resp *Response, err error) {
93 return req.Get("/")
94 },
95 ExpectMethod: "GET",
96 },
97 {
98 SendReq: func(req *Request) (resp *Response, err error) {
99 return req.Post("/")
100 },
101 ExpectMethod: "POST",
102 },
103 {
104 SendReq: func(req *Request) (resp *Response, err error) {
105 return req.Put("/")
106 },
107 ExpectMethod: "PUT",
108 },
109 {
110 SendReq: func(req *Request) (resp *Response, err error) {
111 return req.Patch("/")
112 },
113 ExpectMethod: "PATCH",
114 },
115 {
116 SendReq: func(req *Request) (resp *Response, err error) {
117 return req.Delete("/")
118 },
119 ExpectMethod: "DELETE",
120 },
121 {
122 SendReq: func(req *Request) (resp *Response, err error) {
123 return req.Options("/")
124 },
125 ExpectMethod: "OPTIONS",
126 },
127 {
128 SendReq: func(req *Request) (resp *Response, err error) {
129 return req.Head("/")
130 },
131 ExpectMethod: "HEAD",
132 },
133 {
134 SendReq: func(req *Request) (resp *Response, err error) {
135 return req.Send("GET", "/")
136 },
137 ExpectMethod: "GET",
138 },
139 }
140 for _, tc := range testCases {
141 testMethod(t, c, func(req *Request) *Response {
142 resp, err := tc.SendReq(req)

Callers

nothing calls this directly

Calls 12

tcFunction · 0.85
testMethodFunction · 0.85
SendMethod · 0.80
ErrorfMethod · 0.65
GetMethod · 0.45
PostMethod · 0.45
PutMethod · 0.45
PatchMethod · 0.45
DeleteMethod · 0.45
OptionsMethod · 0.45
HeadMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…