(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestMethodOverride(t *testing.T) { |
| 17 | e := echo.New() |
| 18 | m := MethodOverride() |
| 19 | h := func(c *echo.Context) error { |
| 20 | return c.String(http.StatusOK, "test") |
| 21 | } |
| 22 | |
| 23 | // Override with http header |
| 24 | req := httptest.NewRequest(http.MethodPost, "/", nil) |
| 25 | rec := httptest.NewRecorder() |
| 26 | req.Header.Set(echo.HeaderXHTTPMethodOverride, http.MethodDelete) |
| 27 | c := e.NewContext(req, rec) |
| 28 | |
| 29 | err := m(h)(c) |
| 30 | assert.NoError(t, err) |
| 31 | |
| 32 | assert.Equal(t, http.MethodDelete, req.Method) |
| 33 | |
| 34 | } |
| 35 | |
| 36 | func TestMethodOverride_formParam(t *testing.T) { |
| 37 | e := echo.New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…