MCPcopy Create free account
hub / github.com/imroc/req / testForm

Function testForm

request_test.go:765–786  ·  view source on GitHub ↗
(t *testing.T, c *Client)

Source from the content-addressed store, hash-verified

763}
764
765func testForm(t *testing.T, c *Client) {
766 var userInfo UserInfo
767 resp, err := c.R().
768 SetFormData(map[string]string{
769 "username": "imroc",
770 "type": "xml",
771 }).
772 SetSuccessResult(&userInfo).
773 Post("/search")
774 assertSuccess(t, resp, err)
775 tests.AssertEqual(t, "roc@imroc.cc", userInfo.Email)
776
777 v := make(url.Values)
778 v.Add("username", "imroc")
779 v.Add("type", "xml")
780 resp, err = c.R().
781 SetFormDataFromValues(v).
782 SetSuccessResult(&userInfo).
783 Post("/search")
784 assertSuccess(t, resp, err)
785 tests.AssertEqual(t, "roc@imroc.cc", userInfo.Email)
786}
787
788func TestHostHeaderOverride(t *testing.T) {
789 testWithAllTransport(t, testHostHeaderOverride)

Callers

nothing calls this directly

Calls 8

AssertEqualFunction · 0.92
assertSuccessFunction · 0.85
SetSuccessResultMethod · 0.80
SetFormDataMethod · 0.80
RMethod · 0.80
AddMethod · 0.80
SetFormDataFromValuesMethod · 0.80
PostMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…