mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
Add echo.Binder() method
This commit is contained in:
parent
a708a6781a
commit
4fd9f14769
5
echo.go
5
echo.go
@ -293,6 +293,11 @@ func (e *Echo) SetBinder(b Binder) {
|
||||
e.binder = b
|
||||
}
|
||||
|
||||
// Binder returns the binder instance.
|
||||
func (e *Echo) Binder() Binder {
|
||||
return e.binder
|
||||
}
|
||||
|
||||
// SetRenderer registers an HTML template renderer. It's invoked by `Context#Render()`.
|
||||
func (e *Echo) SetRenderer(r Renderer) {
|
||||
e.renderer = r
|
||||
|
@ -333,3 +333,10 @@ func request(method, path string, e *Echo) (int, string) {
|
||||
e.ServeHTTP(req, rec)
|
||||
return rec.Status(), rec.Body.String()
|
||||
}
|
||||
|
||||
func TestEchoBinder(t *testing.T) {
|
||||
e := New()
|
||||
b := &binder{}
|
||||
e.SetBinder(b)
|
||||
assert.Equal(t, b, e.Binder())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user