Skip to content

Commit ae83d93

Browse files
committed
Merge pull request #66 from brendanhay/withcredentials
Adding support for setting XMLHttpRequest.withCredentials
2 parents c1d346d + 98743b4 commit ae83d93

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/Network/HTTP/Affjax.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ exports._ajax = function (mkHeader, options, canceler, errback, callback) {
7373
})();
7474
};
7575
xhr.responseType = options.responseType;
76+
xhr.withCredentials = options.withCredentials;
7677
xhr.send(options.content);
7778
return canceler(xhr);
7879
};

src/Network/HTTP/Affjax.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type AffjaxRequest a =
6262
, content :: Maybe a
6363
, username :: Maybe String
6464
, password :: Maybe String
65+
, withCredentials :: Boolean
6566
}
6667

6768
defaultRequest :: AffjaxRequest Unit
@@ -72,6 +73,7 @@ defaultRequest =
7273
, content: Nothing
7374
, username: Nothing
7475
, password: Nothing
76+
, withCredentials: false
7577
}
7678

7779
-- | The type of records that will be received as an Affjax response.
@@ -218,6 +220,7 @@ affjax' req eb cb =
218220
, responseType: responseTypeToString (snd responseSettings)
219221
, username: toNullable req.username
220222
, password: toNullable req.password
223+
, withCredentials: req.withCredentials
221224
}
222225

223226
requestSettings :: Tuple (Maybe MimeType) (Maybe RequestContent)
@@ -257,6 +260,7 @@ type AjaxRequest =
257260
, responseType :: String
258261
, username :: Nullable String
259262
, password :: Nullable String
263+
, withCredentials :: Boolean
260264
}
261265

262266
foreign import _ajax

0 commit comments

Comments
 (0)