git.iko.soy/typeable/servant
on master help sign in
WIP: Fix issue #285
commitcf475c26c9b1c66beafadbcbd3157ad4969b85ba authorArian van Putten <aeroboy94@gmail.com> dateSun 6 Dec 2015, 12:40 (11 years ago) parent60f1ddb
1 file changed+1
servant-js/src/Servant/JS/Vanilla.hs+1
servant-js/src/Servant/JS/Vanilla.hs+1
@@ -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"