ss/api.go
2024-05-19 22:48:06 +05:00

28 lines
418 B
Go

package ss
import (
)
type Handler interface {
Handle(c *Context)
}
// The type is used for custom-one-place implementation
// of handling.
type Func func(*Context)
func (fn Func) Handle(c *Context) {
fn(c)
}
// The wrapper for the standard http.Handler(s).
type Wrap struct {
UseRelUrl bool
HttpHandler
}
func (w Wrap) Handle(c *Context) {
if w.UseRelUrl {
c.R.URL = c.RelUrl
}
w.ServeHTTP(c.W, c.R)
}