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

Function TestServeWithHandler_error

echotest/context_test.go:27–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestServeWithHandler_error(t *testing.T) {
28 handler := func(c *echo.Context) error {
29 return echo.NewHTTPError(http.StatusBadRequest, "something went wrong")
30 }
31 testConf := ContextConfig{
32 QueryValues: url.Values{"key": []string{"value"}},
33 }
34
35 customErrHandler := echo.DefaultHTTPErrorHandler(true)
36
37 resp := testConf.ServeWithHandler(t, handler, customErrHandler)
38
39 assert.Equal(t, http.StatusBadRequest, resp.Code)
40 assert.Equal(t, `{"message":"something went wrong"}`+"\n", resp.Body.String())
41}
42
43func TestToContext_QueryValues(t *testing.T) {
44 testConf := ContextConfig{

Callers

nothing calls this directly

Calls 2

ServeWithHandlerMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…