Skip to content

Commit 795dd67

Browse files
committed
Merge pull request #51 from stkb/xhr2
Replace xmlhttprequest module with xhr2
2 parents 112edd8 + dd1f537 commit 795dd67

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ install:
88
script:
99
- gulp
1010
- node ./test-server.js &
11-
- node tmp/test.js
11+
- sleep 2 && node tmp/test.js

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ bower install purescript-affjax
1515
If you are intending to use the library in a Node.js setting rather than the browser, you will need an additional dependency from `npm`:
1616

1717
```
18-
npm install xmlhttprequest
18+
npm install xhr2
1919
```
2020

2121
## Introduction

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"gulp-plumber": "^1.0.0",
1010
"gulp-purescript": "^0.6.0",
1111
"purescript": "^0.7.4-rc.2",
12-
"xmlhttprequest": "^1.7.0"
12+
"xhr2": "^0.1.3"
1313
}
1414
}

src/Network/HTTP/Affjax.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports._ajax = function (mkHeader, options, canceler, errback, callback) {
1111
if (typeof module !== "undefined" && module.require) {
1212
// We are on node.js
1313
platformSpecific.newXHR = function () {
14-
var XHR = module.require("xmlhttprequest").XMLHttpRequest;
14+
var XHR = module.require("xhr2");
1515
return new XHR();
1616
};
1717

@@ -24,8 +24,7 @@ exports._ajax = function (mkHeader, options, canceler, errback, callback) {
2424
};
2525

2626
platformSpecific.getResponse = function (xhr) {
27-
// the node package 'xmlhttprequest' does not support xhr.response.
28-
return xhr.responseText;
27+
return xhr.response;
2928
};
3029
} else {
3130
// We are in the browser

0 commit comments

Comments
 (0)