(method methodTyp, handler http.Handler, pattern string)
| 342 | } |
| 343 | |
| 344 | func (n *node) setEndpoint(method methodTyp, handler http.Handler, pattern string) { |
| 345 | // Set the handler for the method type on the node |
| 346 | if n.endpoints == nil { |
| 347 | n.endpoints = make(endpoints) |
| 348 | } |
| 349 | |
| 350 | paramKeys := patParamKeys(pattern) |
| 351 | |
| 352 | if method&mSTUB == mSTUB { |
| 353 | n.endpoints.Value(mSTUB).handler = handler |
| 354 | } |
| 355 | if method&mALL == mALL { |
| 356 | h := n.endpoints.Value(mALL) |
| 357 | h.handler = handler |
| 358 | h.pattern = pattern |
| 359 | h.paramKeys = paramKeys |
| 360 | for _, m := range methodMap { |
| 361 | h := n.endpoints.Value(m) |
| 362 | h.handler = handler |
| 363 | h.pattern = pattern |
| 364 | h.paramKeys = paramKeys |
| 365 | } |
| 366 | } else { |
| 367 | h := n.endpoints.Value(method) |
| 368 | h.handler = handler |
| 369 | h.pattern = pattern |
| 370 | h.paramKeys = paramKeys |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | func (n *node) FindRoute(rctx *Context, method methodTyp, path string) (*node, endpoints, http.Handler) { |
| 375 | // Reset the context routing pattern and params |
no test coverage detected