go-res
go-res copied to clipboard
Handler bubbling
Issue
In case a res.Handler
does not contain a handler method for a given request, it should bubble up to the next best res.Handler
match.
Example
s := res.Service("test")
s.Handle("model",
res.GetModel(func(r res.ModelRequest) {
r.Model(json.RawMessage(`{"foo":"bar"}`)
}),
)
s.Handle(">", res.Access(res.AccessGranted))
An access request, access.test.model
, should be handled by the handler for the wildcard ">"
as the "model"
handler has does not have an access handler method.
+1
I would really like to help you add this feature. I would like to know if the goal is to modify the add()
method of the Mux
type?
https://github.com/jirenius/go-res/blob/master/mux.go#L270-L288