@@ -34,6 +34,7 @@ generateVanillaJSWith opts req = "\n" <>
3434 <> " xhr.open('" <> method <> "', " <> url <> ", true);\n"
3535 <> reqheaders
3636 <> " xhr.setRequestHeader(\"Accept\",\"application/json\");\n"
37+ <> (if isJust (req ^. reqBody) then " xhr.setRequestHeader(\"Content-Type\",\"application/json\");\n" else "")
3738 <> " xhr.onreadystatechange = function (e) {\n"
3839 <> " if (xhr.readyState == 4) {\n"
3940 <> " var value = JSON.parse(xhr.responseText);\n"