MCPcopy
hub / github.com/labstack/echo / TestContext_Bind

Function TestContext_Bind

context_test.go:1326–1336  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1324}
1325
1326func TestContext_Bind(t *testing.T) {
1327 e := New()
1328 req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(userJSON))
1329 c := e.NewContext(req, nil)
1330 u := new(user)
1331
1332 req.Header.Add(HeaderContentType, MIMEApplicationJSON)
1333 err := c.Bind(u)
1334 assert.NoError(t, err)
1335 assert.Equal(t, &user{ID: 1, Name: "Jon Snow"}, u)
1336}
1337
1338func TestContext_RealIP(t *testing.T) {
1339 _, ipv6ForRemoteAddrExternalRange, _ := net.ParseCIDR("2001:db8::/64")

Callers

nothing calls this directly

Calls 4

BindMethod · 0.95
NewFunction · 0.85
NewContextMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…