2023-12-07 16:55:23 +03:00
|
|
|
package bond
|
|
|
|
|
|
|
|
import (
|
|
|
|
)
|
|
|
|
|
2024-01-10 20:11:02 +03:00
|
|
|
type Handler interface {
|
|
|
|
Handle(c *Context)
|
2023-12-07 16:55:23 +03:00
|
|
|
}
|
|
|
|
|
2024-01-10 20:11:02 +03:00
|
|
|
// The type is used for custom-one-place implementation
|
|
|
|
// of handling.
|
2024-01-03 21:23:03 +03:00
|
|
|
type Func func(*Context)
|
2024-01-10 20:11:02 +03:00
|
|
|
func (fn Func) Handle(c *Context) {
|
|
|
|
fn(c)
|
2023-12-07 16:55:23 +03:00
|
|
|
}
|
|
|
|
|
2024-01-10 20:11:02 +03:00
|
|
|
// The wrapper for the standard http.Handler(s).
|
|
|
|
type Wrap struct {
|
|
|
|
HttpHandler
|
2024-01-03 21:23:03 +03:00
|
|
|
}
|
2024-01-10 20:11:02 +03:00
|
|
|
func (w Wrap) Handle(c *Context) {
|
|
|
|
w.ServeHTTP(c.W, c.R)
|
2023-12-07 16:55:23 +03:00
|
|
|
}
|
|
|
|
|