Compare commits

...

17 Commits

Author SHA1 Message Date
John Hiesey 5e25ed2f65 2.2.1 2016-03-25 18:53:56 -07:00
John Hiesey b339f4afa9 Fix microsoft edge versions for newer zuul 2016-03-24 03:09:09 -07:00
John Hiesey 4b1419cff7 2.2.0 2016-03-01 15:25:22 -08:00
John Hiesey c9183cd2ad Style fixup 2016-03-01 15:05:17 -08:00
John Hiesey 0f1f0c6365 Merge pull request #37 from sportle/feature/set-cookie-array
Set-Cookie headers should be arrays
2016-03-01 15:04:03 -08:00
Phil Larson 581a4d12da Set-Cookie headers should be arrays 2016-03-01 10:15:19 -08:00
Feross Aboukhadijeh 945083bd1d 2.1.1 2016-02-15 21:32:47 -08:00
Feross Aboukhadijeh 2054c18374 sauce labs: add microsoft edge 2016-02-15 20:54:38 -08:00
Feross Aboukhadijeh 218fd54ef0 builtin-status-codes@2 2016-02-15 20:51:06 -08:00
John Hiesey 9d24d5510a 2.1.0 2016-01-13 05:46:14 +01:00
John Hiesey ff68130d89 Add missing "bugs" and "homepage" entries to package.json 2016-01-13 05:10:57 +01:00
John Hiesey 6bab67d17a Use to-arraybuffer instead of manual conversion
This fixes some more edge cases when converting from a Buffer to
an ArrayBuffer.

Additionally, compared v2.0.5, this avoids an unnecessary copy
when sending data in a request body.
2016-01-13 03:40:41 +01:00
John Hiesey 6433ea8cad Replace buffer.buffer with more compatible version
Unforunately some browsers use a version of Buffer
that isn't based on a Uint8Array. Add logic to convert
when necessary but not make copies when unnecessary.
2016-01-13 01:33:11 +01:00
John Hiesey 9ebf801ebb Fix typos 2016-01-12 22:39:46 +01:00
John Hiesey 154f6b9e56 Fix buffer usage in tests as well 2016-01-12 22:18:41 +01:00
John Hiesey 6dea87e704 Merge pull request #36 from karissa/master
Use .buffer to comply with buffer@4 and browserify@13.
2016-01-12 21:56:37 +01:00
Karissa McKelvey 8b9f5a43c1 Use .buffer to comply with buffer@4 and browserify@13 2016-01-12 12:30:39 -08:00
6 changed files with 23 additions and 9 deletions
+3 -1
View File
@@ -6,6 +6,8 @@ browsers:
version: 34..latest
- name: safari
version: 5..latest
- name: microsoftedge
version: 13..latest
- name: ie
version: 9..latest
- name: opera
@@ -17,4 +19,4 @@ browsers:
server: ./test/server/index.js
scripts:
- "/ie8-polyfill.js"
- "/test-polyfill.js"
- "/test-polyfill.js"
+2 -2
View File
@@ -81,7 +81,7 @@ characteristics as this mode did in versions before 1.5.
* Any operations, including `request.setTimeout`, that operate directly on the underlying
socket.
* Any options that are disallowed for security reasons. This includes setting or getting
certian headers.
certain headers.
* `message.httpVersion`
* `message.rawHeaders` is modified by the browser, and may not quite match what is sent by
the server.
@@ -112,7 +112,7 @@ that run in the browser (found in `test/browser`). Normally the browser tests ru
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).
credentials in a [`.zuulrc` file](https://github.com/defunctzombie/zuul/wiki/zuulrc).
To run just the node tests, run `npm run test-node`.
+2 -1
View File
@@ -3,6 +3,7 @@ var capability = require('./capability')
var inherits = require('inherits')
var response = require('./response')
var stream = require('stream')
var toArrayBuffer = require('to-arraybuffer')
var IncomingMessage = response.IncomingMessage
var rStates = response.readyStates
@@ -96,7 +97,7 @@ ClientRequest.prototype._onFinish = function () {
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()
return toArrayBuffer(buffer)
}), {
type: (headersObj['content-type'] || {}).value || ''
})
+8 -2
View File
@@ -67,10 +67,16 @@ var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) {
var matches = header.match(/^([^:]+):\s*(.*)/)
if (matches) {
var key = matches[1].toLowerCase()
if (self.headers[key] !== undefined)
if (key === 'set-cookie') {
if (self.headers[key] === undefined) {
self.headers[key] = []
}
self.headers[key].push(matches[2])
} else if (self.headers[key] !== undefined) {
self.headers[key] += ', ' + matches[2]
else
} else {
self.headers[key] = matches[2]
}
self.rawHeaders.push(matches[1], matches[2])
}
})
+7 -2
View File
@@ -1,6 +1,6 @@
{
"name": "stream-http",
"version": "2.0.5",
"version": "2.2.1",
"description": "Streaming http in the browser",
"main": "index.js",
"repository": {
@@ -15,6 +15,10 @@
},
"author": "John Hiesey",
"license": "MIT",
"bugs": {
"url": "https://github.com/jhiesey/stream-http/issues"
},
"homepage": "https://github.com/jhiesey/stream-http#readme",
"keywords": [
"http",
"stream",
@@ -23,8 +27,9 @@
"http-browserify"
],
"dependencies": {
"builtin-status-codes": "^1.0.0",
"builtin-status-codes": "^2.0.0",
"inherits": "^2.0.1",
"to-arraybuffer": "^1.0.0",
"xtend": "^4.0.0"
},
"devDependencies": {
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = function (self) {
var buffers = []
res.on('end', function () {
self.postMessage(Buffer.concat(buffers).toArrayBuffer())
self.postMessage(Buffer.concat(buffers).buffer)
})
res.on('data', function (data) {