Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cbc0bd803c | |||
| d6de2ce3a5 | |||
| 4bcff63d46 | |||
| a69310d8fc | |||
| ae48c2c71c | |||
| 570f85ec18 | |||
| 85381f0e3d | |||
| 3bea2a493f | |||
| 016f4be96f | |||
| 9e5e75b5ff | |||
| 031b8aab89 |
+1
-1
@@ -1,3 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.12"
|
||||
- "4.1"
|
||||
@@ -104,6 +104,21 @@ http.get('/bundle.js', function (res) {
|
||||
})
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
There are two sets of tests: the tests that run in node (found in `test/node`) and the tests
|
||||
that run in the browser (found in `test/browser`). Normally the browser tests run on
|
||||
[Sauce Labs](http://saucelabs.com/).
|
||||
|
||||
Running `npm test` will run both sets of tests, but in order for the Sauce Labs tests to run
|
||||
you will need to sign up for an account (free for open source projects) and put the
|
||||
credentials in [a `.zuulrc` file](https://github.com/defunctzombie/zuul/wiki/zuulrc).
|
||||
|
||||
To run just the node tests, run `npm run test-node`.
|
||||
|
||||
To run the browser tests locally, run `npm run test-browser-local` and point your browser to
|
||||
`http://localhost:8080/__zuul`
|
||||
|
||||
## License
|
||||
|
||||
MIT. Copyright (C) John Hiesey and other contributors.
|
||||
|
||||
+7
-5
@@ -93,7 +93,7 @@ ClientRequest.prototype._onFinish = function () {
|
||||
|
||||
var headersObj = self._headers
|
||||
var body
|
||||
if (opts.method === 'POST' || opts.method === 'PUT') {
|
||||
if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') {
|
||||
if (capability.blobConstructor) {
|
||||
body = new global.Blob(self._body.map(function (buffer) {
|
||||
return buffer.toArrayBuffer()
|
||||
@@ -120,7 +120,7 @@ ClientRequest.prototype._onFinish = function () {
|
||||
}).then(function (response) {
|
||||
self._fetchResponse = response
|
||||
self._connect()
|
||||
}).then(undefined, function (reason) {
|
||||
}, function (reason) {
|
||||
self.emit('error', reason)
|
||||
})
|
||||
} else {
|
||||
@@ -183,12 +183,14 @@ ClientRequest.prototype._onFinish = function () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if xhr.status is readable. Even though the spec says it should
|
||||
* be available in readyState 3, accessing it throws an exception in IE8
|
||||
* Checks if xhr.status is readable and non-zero, indicating no error.
|
||||
* Even though the spec says it should be available in readyState 3,
|
||||
* accessing it throws an exception in IE8
|
||||
*/
|
||||
function statusValid (xhr) {
|
||||
try {
|
||||
return (xhr.status !== null)
|
||||
var status = xhr.status
|
||||
return (status !== null && status !== 0)
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "stream-http",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.4",
|
||||
"description": "Streaming http in the browser",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -8,7 +8,7 @@
|
||||
"url": "git://github.com/jhiesey/stream-http.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run test-node && npm run test-browser",
|
||||
"test": "npm run test-node && ([ -n \"${TRAVIS_PULL_REQUEST}\" -a \"${TRAVIS_PULL_REQUEST}\" != 'false' ] || npm run test-browser)",
|
||||
"test-node": "tape test/node/*.js",
|
||||
"test-browser": "zuul --no-coverage -- test/browser/*.js",
|
||||
"test-browser-local": "zuul --local 8080 --no-coverage -- test/browser/*.js"
|
||||
|
||||
Reference in New Issue
Block a user