Skip to content

Commit 8a8bee4

Browse files
author
Denis Rechkunov
committed
Add XMLHttpRequest.withCredentials option for the browser.
1 parent 8e0cd83 commit 8a8bee4

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ UHRBase.prototype.request = function (parameters) { }
113113
{
114114
method: 'GET',
115115
timeout: 30000,
116+
// sets value to XMLHttpRequest.withCredentials, works only in the browser
117+
withCredentials: false,
116118
unsafeHTTPS: false, // require valid certificate by default
117119
headers: {
118120
Cookie: 'name=value'

browser/UHR.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ UHR.prototype._doRequest = function (parameters) {
131131
);
132132
xhr.timeout = parameters.timeout;
133133

134+
if (parameters.withCredentials) {
135+
xhr.withCredentials = true;
136+
}
137+
134138
Object.keys(parameters.headers)
135139
.forEach(function (headerName) {
136140
xhr.setRequestHeader(

0 commit comments

Comments
 (0)