UseSpecialHandlers execute all special handlers
(ctx context.Context, req *http.Request, resp http.ResponseWriter)
| 55 | |
| 56 | // UseSpecialHandlers execute all special handlers |
| 57 | func (s *Server) UseSpecialHandlers(ctx context.Context, req *http.Request, resp http.ResponseWriter) (context.Context, error) { |
| 58 | if len(s.specialHandlers) == 0 { |
| 59 | return ctx, ErrNoSpecialHandlerFound |
| 60 | } |
| 61 | |
| 62 | c := &SpecialHandlerContext{ |
| 63 | request: req, |
| 64 | response: resp, |
| 65 | ctx: ctx, |
| 66 | } |
| 67 | for _, l := range s.specialHandlers { |
| 68 | err := l.Handle(c) |
| 69 | if err != nil { |
| 70 | return c.ctx, err |
| 71 | } |
| 72 | } |
| 73 | return c.ctx, nil |
| 74 | } |