Skip to content

Commit

Permalink
testing/server: docs for CustomHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
fsouza committed Jul 4, 2014
1 parent 064d3ea commit e21b2a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions testing/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ func (s *DockerServer) ResetFailure(id string) {
delete(s.failures, id)
}

// CustomHandler registers a custom handler for a specific path.
//
// For example:
//
// server.CustomHandler("/containers/json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// http.Error(w, "Something wrong is not right", http.StatusInternalServerError)
// }))
func (s *DockerServer) CustomHandler(path string, handler http.Handler) {
s.handlerMutex.Lock()
s.customHandlers[path] = handler
Expand Down

0 comments on commit e21b2a4

Please sign in to comment.