@@ -33,6 +33,8 @@ generateVanillaJSWith opts req = "\n" <>
3333 <> " var xhr = new XMLHttpRequest();\n"
3434 <> " xhr.open('" <> method <> "', " <> url <> ", true);\n"
3535 <> reqheaders
36+ <> " xhr.setRequestHeader(\"Accept\",\"application/json\");\n"
37+ <> (if isJust (req ^. reqBody) then " xhr.setRequestHeader(\"Content-Type\",\"application/json\");\n" else "")
3638 <> " xhr.onreadystatechange = function (e) {\n"
3739 <> " if (xhr.readyState == 4) {\n"
3840 <> " var value = JSON.parse(xhr.responseText);\n"