From 3b4df6775be969371ce100d2bf0eca358882ec74 Mon Sep 17 00:00:00 2001 From: bwo Date: Tue, 7 Jul 2015 21:25:32 -0700 Subject: [PATCH] servant-jquery: set content type to application/json on POST Also remove some redundant newlines in generated JS. --- servant-jquery/src/Servant/JQuery.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/servant-jquery/src/Servant/JQuery.hs b/servant-jquery/src/Servant/JQuery.hs index 729a3fd9..974b3925 100644 --- a/servant-jquery/src/Servant/JQuery.hs +++ b/servant-jquery/src/Servant/JQuery.hs @@ -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 = "\"" ++