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

Function TestBindHeaderParamBadType

bind_test.go:293–307  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

291}
292
293func TestBindHeaderParamBadType(t *testing.T) {
294 e := New()
295 req := httptest.NewRequest(http.MethodGet, "/", nil)
296 req.Header.Set("Id", "salamander")
297 rec := httptest.NewRecorder()
298 c := e.NewContext(req, rec)
299 u := new(user)
300 err := BindHeaders(c, u)
301 assert.Error(t, err)
302
303 httpErr, ok := err.(*HTTPError)
304 if assert.True(t, ok) {
305 assert.Equal(t, http.StatusBadRequest, httpErr.Code)
306 }
307}
308
309func TestBindUnmarshalParam(t *testing.T) {
310 e := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
BindHeadersFunction · 0.85
SetMethod · 0.80
NewContextMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…