MCPcopy Index your code
hub / github.com/labstack/echo / testBindArrayOkay

Function testBindArrayOkay

bind_test.go:718–735  ·  view source on GitHub ↗
(t *testing.T, r io.Reader, query url.Values, ctype string)

Source from the content-addressed store, hash-verified

716}
717
718func testBindArrayOkay(t *testing.T, r io.Reader, query url.Values, ctype string) {
719 e := New()
720 path := "/"
721 if len(query) > 0 {
722 path += "?" + query.Encode()
723 }
724 req := httptest.NewRequest(http.MethodPost, path, r)
725 rec := httptest.NewRecorder()
726 c := e.NewContext(req, rec)
727 req.Header.Set(HeaderContentType, ctype)
728 u := []user{}
729 err := c.Bind(&u)
730 if assert.NoError(t, err) {
731 assert.Equal(t, 1, len(u))
732 assert.Equal(t, 1, u[0].ID)
733 assert.Equal(t, "Jon Snow", u[0].Name)
734 }
735}
736
737func testBindError(t *testing.T, r io.Reader, ctype string, expectedInternal error) {
738 e := New()

Callers 2

TestBindJSONFunction · 0.85
TestBindXMLFunction · 0.85

Calls 4

BindMethod · 0.95
NewFunction · 0.85
NewContextMethod · 0.80
SetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…