Merge pull request #150 from haskell-servant/pingu/jquery-post-content-type-take2
servant-jquery: set content type to application/json on POST
This commit is contained in:
commit
490a84cda1
1 changed files with 3 additions and 2 deletions
|
@ -65,13 +65,14 @@ generateJS req = "\n" <>
|
||||||
|
|
||||||
dataBody =
|
dataBody =
|
||||||
if req ^. reqBody
|
if req ^. reqBody
|
||||||
then "\n , data: JSON.stringify(body)\n"
|
then " , data: JSON.stringify(body)\n" <>
|
||||||
|
" , contentType: 'application/json'\n"
|
||||||
else ""
|
else ""
|
||||||
|
|
||||||
reqheaders =
|
reqheaders =
|
||||||
if null hs
|
if null hs
|
||||||
then ""
|
then ""
|
||||||
else "\n , headers: { " ++ headersStr ++ " }\n"
|
else " , headers: { " ++ headersStr ++ " }\n"
|
||||||
|
|
||||||
where headersStr = intercalate ", " $ map headerStr hs
|
where headersStr = intercalate ", " $ map headerStr hs
|
||||||
headerStr header = "\"" ++
|
headerStr header = "\"" ++
|
||||||
|
|
Loading…
Reference in a new issue