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

Function TestMethodOverride

middleware/method_override_test.go:16–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func 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
36func TestMethodOverride_formParam(t *testing.T) {
37 e := echo.New()

Callers

nothing calls this directly

Calls 4

StringMethod · 0.95
MethodOverrideFunction · 0.85
SetMethod · 0.80
NewContextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…