Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dist/xhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ XHookHttpRequest = window[XMLHTTP] = function() {
_ref1 = ['type', 'timeout', 'withCredentials'];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
k = _ref1[_j];
if (k === 'withCredentials' && !request.async) {
continue;
}
modk = k === "type" ? "responseType" : k;
if (modk in facade) {
request[k] = facade[modk];
Expand Down
2 changes: 1 addition & 1 deletion dist/xhook.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/xhook.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ XHookHttpRequest = window[XMLHTTP] = ->
facade.send = (body) ->
#read xhr settings before hooking
for k in ['type', 'timeout', 'withCredentials']
continue if (k is 'withCredentials' and not request.async)
modk = if k is "type" then "responseType" else k
request[k] = facade[modk] if modk of facade

Expand Down
7 changes: 7 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@ describe('xhook', function() {
};
xhr.send();
});

it('sync XHR should not fail', function(done) {
var xhr = new XMLHttpRequest();
xhr.open('GET', '../example/example1.txt', false);
xhr.send();
done();
});
});