From a8f8fd57cf405d9a6ec7ac9fb94db01f7368466c Mon Sep 17 00:00:00 2001 From: mpl Date: Wed, 23 Apr 2014 15:19:40 +0200 Subject: [PATCH] httputil: allow full error serving when with devcam When hacking on e.g. importers, I sometimes want to use devcam with -hostname, to test with a non local context. In which case, when hitting an error httputil.ServeError would not print the full error, which makes it harder to debug. Change-Id: I2fb8c97748d4f077404fbf12010addd6e7af3572 --- pkg/httputil/httputil.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/httputil/httputil.go b/pkg/httputil/httputil.go index a1d57b2d4..dfedb1c53 100644 --- a/pkg/httputil/httputil.go +++ b/pkg/httputil/httputil.go @@ -27,6 +27,7 @@ import ( "net" "net/http" "net/url" + "os" "path" "strconv" "strings" @@ -63,7 +64,7 @@ func RequestEntityTooLargeError(conn http.ResponseWriter) { func ServeError(conn http.ResponseWriter, req *http.Request, err error) { conn.WriteHeader(http.StatusInternalServerError) - if IsLocalhost(req) { + if IsLocalhost(req) || os.Getenv("CAMLI_DEV_CAMLI_ROOT") != "" { fmt.Fprintf(conn, "Server error: %s\n", err) return }