Commit 38a6fc5
Fix: Clarify limitations of custom context
The router expects the Echo Context to be the internal type `*context` ([reference](https://github.com/labstack/echo/blob/v4.2.2/router.go#L341)), so it cannot be replaced by a custom context before that.
Currently, if you try to define the custom middleware before the router (via `Pre` method) the following panic will be raised:
```
echo: http: panic serving 172.23.0.1:49366: interface conversion: echo.Context is context.Context, not *echo.context
goroutine 8 [running]:
net/http.(*conn).serve.func1(0xc0001260a0)
/usr/local/go/src/net/http/server.go:1824 +0x153
panic(0x803bc0, 0xc000114f90)
/usr/local/go/src/runtime/panic.go:971 +0x499
github.com/labstack/echo/v4.(*Router).Find(0xc00000ea68, 0xc00002a260, 0x4, 0xc00002a265, 0xc, 0x8fc228, 0xc0000613e0)
/go/pkg/mod/github.com/labstack/echo/v4@v4.2.2/router.go:341 +0x77e
```1 parent 3841945 commit 38a6fc5
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
0 commit comments