servant-jquery: set content type to application/json on POST
Also remove some redundant newlines in generated JS.
This commit is contained in:
parent
1efe9f1a2a
commit
3b4df6775b
1 changed files with 3 additions and 2 deletions
|
@ -65,13 +65,14 @@ generateJS req = "\n" <>
|
|||
|
||||
dataBody =
|
||||
if req ^. reqBody
|
||||
then "\n , data: JSON.stringify(body)\n"
|
||||
then " , data: JSON.stringify(body)\n" <>
|
||||
" , contentType: 'application/json'\n"
|
||||
else ""
|
||||
|
||||
reqheaders =
|
||||
if null hs
|
||||
then ""
|
||||
else "\n , headers: { " ++ headersStr ++ " }\n"
|
||||
else " , headers: { " ++ headersStr ++ " }\n"
|
||||
|
||||
where headersStr = intercalate ", " $ map headerStr hs
|
||||
headerStr header = "\"" ++
|
||||
|
|
Loading…
Reference in a new issue