MCPcopy Index your code
hub / github.com/livebud/bud / isHandlerFunc

Method isHandlerFunc

framework/controller/loader.go:188–214  ·  view source on GitHub ↗
(params []*parser.Param, results []*parser.Result)

Source from the content-addressed store, hash-verified

186}
187
188func (l *loader) isHandlerFunc(params []*parser.Param, results []*parser.Result) bool {
189 if len(params) != 2 || len(results) != 0 {
190 return false
191 }
192
193 maybeW := params[0].Type()
194 isW, err := parser.IsImportType(maybeW, "net/http", "ResponseWriter")
195 if err != nil {
196 l.Bail(err)
197 }
198
199 if !isW {
200 return false
201 }
202
203 maybeR := params[1].Type()
204 isR, err := parser.IsImportType(maybeR, "net/http", "Request")
205 if err != nil {
206 l.Bail(err)
207 }
208
209 if !isR {
210 return false
211 }
212
213 return true
214}
215
216// Route to the action
217func (l *loader) loadActionRoute(controllerRoute, actionName string) string {

Callers 1

loadActionMethod · 0.95

Calls 3

IsImportTypeFunction · 0.92
BailMethod · 0.80
TypeMethod · 0.65

Tested by

no test coverage detected