From dae65b7d1fadc9d6dd3a25b6a98714adf437a80a Mon Sep 17 00:00:00 2001 From: Rob Loranger Date: Thu, 19 Dec 2019 08:28:06 -0800 Subject: [PATCH] retain output structure in response --- postrender.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/postrender.go b/postrender.go index f5b5649..02b156b 100644 --- a/postrender.go +++ b/postrender.go @@ -258,5 +258,11 @@ func handleRenderMarkdown(app *App, w http.ResponseWriter, r *http.Request) erro return ErrBadJSON } - return impart.WriteSuccess(w, applyMarkdown([]byte(in.RawBody), in.BaseURL, app.cfg), http.StatusOK) + out := struct { + Body string `json:"body"` + }{ + Body: applyMarkdown([]byte(in.RawBody), in.BaseURL, app.cfg), + } + + return impart.WriteSuccess(w, out, http.StatusOK) }