ServeHTTP handles HTTP requests sent to the server.
(w http.ResponseWriter, r *http.Request)
| 313 | |
| 314 | // ServeHTTP handles HTTP requests sent to the server. |
| 315 | func (s *DockerServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 316 | s.handlerMutex.RLock() |
| 317 | defer s.handlerMutex.RUnlock() |
| 318 | for re, handler := range s.customHandlers { |
| 319 | if m, _ := regexp.MatchString(re, r.URL.Path); m { |
| 320 | handler.ServeHTTP(w, r) |
| 321 | return |
| 322 | } |
| 323 | } |
| 324 | s.mux.ServeHTTP(w, r) |
| 325 | if s.hook != nil { |
| 326 | s.hook(r) |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | // DefaultHandler returns default http.Handler mux, it allows customHandlers to |
| 331 | // call the default behavior if wanted. |
no outgoing calls