Skip to content

Commit 07c3e72

Browse files
author
Andrew Cady
committed
Servant.Foreign replaced reqBodyIsJSON with ReqBodyMultipart
1 parent 87675e1 commit 07c3e72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Servant/JS/Vanilla.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Data.Text (Text)
77
import Data.Text.Encoding (decodeUtf8)
88
import qualified Data.Text as T
99
import Data.Monoid
10-
import Servant.Foreign
10+
import Servant.Foreign hiding (header)
1111
import Servant.JS.Internal
1212

1313
-- | Generate vanilla javascript functions to make AJAX requests
@@ -34,7 +34,7 @@ generateVanillaJSWith opts req = "\n" <>
3434
<> " xhr.open('" <> decodeUtf8 method <> "', " <> url <> ", true);\n"
3535
<> reqheaders
3636
<> " xhr.setRequestHeader('Accept', 'application/json');\n"
37-
<> (if isJust (req ^. reqBody) && (req ^. reqBodyIsJSON) then " xhr.setRequestHeader('Content-Type', 'application/json');\n" else "")
37+
<> (if isJust (req ^. reqBody) && (req ^. reqBodyContentType == ReqBodyJSON) then " xhr.setRequestHeader('Content-Type', 'application/json');\n" else "")
3838
<> " xhr.onreadystatechange = function () {\n"
3939
<> " var res = null;\n"
4040
<> " if (xhr.readyState === 4) {\n"
@@ -79,7 +79,7 @@ generateVanillaJSWith opts req = "\n" <>
7979

8080
dataBody =
8181
if isJust (req ^. reqBody)
82-
then if (req ^. reqBodyIsJSON) then "JSON.stringify(body)" else "body"
82+
then if (req ^. reqBodyContentType == ReqBodyJSON) then "JSON.stringify(body)" else "body"
8383
else "null"
8484

8585

0 commit comments

Comments
 (0)