MCPcopy
hub / github.com/stretchr/testify / TestHTTPRequestWithParams

Function TestHTTPRequestWithParams

assert/http_assertions_test.go:180–196  ·  assert/http_assertions_test.go::TestHTTPRequestWithParams
(t *testing.T)

Source from the content-addressed store, hash-verified

178}
179
180func TestHTTPRequestWithParams(t *testing.T) {
181 t.Parallel()
182
183 var got *http.Request
184 handler := func(w http.ResponseWriter, r *http.Request) {
185 got = r
186 w.WriteHeader(http.StatusOK)
187 }
188 params := url.Values{}
189 params.Add("id", "12345")
190
191 True(t, HTTPSuccess(t, handler, "GET", "/url", params))
192
193 Equal(t, url.Values{"id": []string{"12345"}}, got.URL.Query())
194 Equal(t, "/url?id=12345", got.URL.String())
195 Equal(t, "/url?id=12345", got.URL.RequestURI())
196}
197
198func TestHttpBody(t *testing.T) {
199 t.Parallel()

Callers

nothing calls this directly

Calls 5

WriteHeaderMethod · 0.80
TrueFunction · 0.70
HTTPSuccessFunction · 0.70
EqualFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected