server: Accept POST instead of GET at babelmark endpoint.

This commit is contained in:
John MacFarlane 2022-08-08 08:35:32 -07:00
parent 4e003e9cdb
commit 297e48661d
2 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -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;
})();
</script>