diff --git a/AUTHORS b/AUTHORS index dacec23e..2bfcd75c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -22,3 +22,4 @@ List of contributors, in chronological order: * Phil Frost (https://github.com/bitglue) * Benoit Foucher (https://github.com/bentoi) * Geoffrey Thomas (https://github.com/geofft) +* Harald Sitter (https://github.com/apachelogger) diff --git a/api/graph.go b/api/graph.go index 66ed4444..0d11d706 100644 --- a/api/graph.go +++ b/api/graph.go @@ -39,6 +39,13 @@ func apiGraph(c *gin.Context) { buf := bytes.NewBufferString(graph.String()) + if ext == "dot" || ext == "gv" { + // If the raw dot data is requested, return it as string. + // This allows client-side rendering rather than server-side. + c.String(200, buf.String()) + return + } + command := exec.Command("dot", "-T"+ext) command.Stderr = os.Stderr diff --git a/system/t12_api/graph.py b/system/t12_api/graph.py index 2f2a9f10..bc024fc2 100644 --- a/system/t12_api/graph.py +++ b/system/t12_api/graph.py @@ -15,3 +15,7 @@ class GraphAPITest(APITest): resp = self.get("/api/graph.svg") self.check_equal(resp.headers["Content-Type"], "image/svg+xml") self.check_equal(resp.content[:4], '