MCPcopy
hub / github.com/fsouza/go-dockerclient / ServeHTTP

Method ServeHTTP

testing/server.go:315–328  ·  view source on GitHub ↗

ServeHTTP handles HTTP requests sent to the server.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

313
314// ServeHTTP handles HTTP requests sent to the server.
315func (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.

Callers 15

TestHandleWithHookFunction · 0.80
TestSetHookFunction · 0.80
TestCustomHandlerFunction · 0.80
TestCustomHandlerRegexpFunction · 0.80
TestListContainersFunction · 0.80
TestCreateContainerFunction · 0.80

Calls

no outgoing calls

Tested by 15

TestHandleWithHookFunction · 0.64
TestSetHookFunction · 0.64
TestCustomHandlerFunction · 0.64
TestCustomHandlerRegexpFunction · 0.64
TestListContainersFunction · 0.64
TestCreateContainerFunction · 0.64