some refactoring and tidying

- some inlining
- compile regexps once
- consistent error messages
- always mention container id in startContainerInterceptor errors
This commit is contained in:
Matthias Radestock authored and Paul Bellamy committed 2015-05-19 10:34:46 +01:00
1 parent ca4b8e6f8e
commit 126d4f4079
4 files changed
+51 -84

No files matched your search

+2 -2
View File
@@ -33,7 +33,7 @@ func (c *client) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
if err != nil {
http.Error(w, "Unable to create proxied request", http.StatusInternalServerError)
http.Error(w, "Unable to intercept request", http.StatusInternalServerError)
Warning.Print("Error intercepting request: ", err)
return
}
@@ -49,7 +49,7 @@ func (c *client) ServeHTTP(w http.ResponseWriter, r *http.Request) {
resp, err := client.Do(req)
if err != nil && err != httputil.ErrPersistEOF {
http.Error(w, fmt.Sprintf("Could not make request to target: %s", err.Error()), http.StatusInternalServerError)
http.Error(w, fmt.Sprintf("Could not make request to target: %v", err), http.StatusInternalServerError)
Warning.Print("Error forwarding request: ", err)
return
}