From 297e48661d5df5d0d6d306b5bd5844301cbc093a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 8 Aug 2022 08:35:32 -0700 Subject: [PATCH] server: Accept POST instead of GET at babelmark endpoint. --- server/PandocServer.hs | 2 +- trypandoc/index.html | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/PandocServer.hs b/server/PandocServer.hs index 5b02c4ea3..4dde68efb 100644 --- a/server/PandocServer.hs +++ b/server/PandocServer.hs @@ -45,7 +45,7 @@ type API = :<|> ReqBody '[JSON] [Params] :> Post '[JSON] [Text] :<|> - "babelmark" :> ReqBody '[JSON] Params :> Get '[JSON] Value + "babelmark" :> ReqBody '[JSON] Params :> Post '[JSON] Value :<|> "version" :> Get '[PlainText, JSON] Text diff --git a/trypandoc/index.html b/trypandoc/index.html index 846b51515..fd4664778 100644 --- a/trypandoc/index.html +++ b/trypandoc/index.html @@ -159,7 +159,7 @@ function newpage() { let standalone = params.get("standalone") === "true"; document.getElementById("standalone").checked = standalone; if (text && text != "") { - fetch("/cgi-bin/pandoc-cgi/version") + fetch("/cgi-bin/pandoc-server.cgi/version") .then(response => response.text()) .then(restext => document.getElementById("version").textContent = restext @@ -167,7 +167,7 @@ function newpage() { let params = { from: from, to: to, text: text, standalone: standalone }; // console.log(JSON.stringify(params)); - fetch("/cgi-bin/pandoc-cgi", { + fetch("/cgi-bin/pandoc-server.cgi", { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify(params) @@ -182,8 +182,9 @@ function newpage() { }); }; document.getElementById("convert").onclick = newpage; - document.getElementById("from").onclick = newpage; - document.getElementById("to").onclick = newpage; + document.getElementById("from").onchange = newpage; + document.getElementById("to").onchange = newpage; + document.getElementById("standalone").onchange = newpage; })();