(t *testing.T)
| 73 | } |
| 74 | |
| 75 | func TestBodyDump_fails(t *testing.T) { |
| 76 | e := echo.New() |
| 77 | hw := "Hello, World!" |
| 78 | req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(hw)) |
| 79 | rec := httptest.NewRecorder() |
| 80 | c := e.NewContext(req, rec) |
| 81 | h := func(c *echo.Context) error { |
| 82 | return errors.New("some error") |
| 83 | } |
| 84 | |
| 85 | mw, err := BodyDumpConfig{Handler: func(c *echo.Context, reqBody, resBody []byte, err error) {}}.ToMiddleware() |
| 86 | assert.NoError(t, err) |
| 87 | |
| 88 | err = mw(h)(c) |
| 89 | assert.EqualError(t, err, "some error") |
| 90 | assert.Equal(t, http.StatusOK, rec.Code) |
| 91 | |
| 92 | } |
| 93 | |
| 94 | func TestBodyDumpWithConfig_panic(t *testing.T) { |
| 95 | assert.Panics(t, func() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…