Compare commits

...

4 Commits

Author SHA1 Message Date
John Hiesey c09a871543 2.7.2 2017-06-12 13:21:48 -07:00
John Hiesey 856a572341 fix tests on Safari 10.0 on iOS 10.3 2017-06-12 13:01:14 -07:00
John Hiesey 4175a65117 Merge pull request #78 from EsrefDurna/master
updated package.json
2017-06-12 11:51:51 -07:00
Esref Durna e2bfae151c updated package cookie-parser from 1.3.5 to 1.4.3
Npm link :  https://www.npmjs.com/package/cookie-parser
 Repository link : https://github.com/expressjs/cookie-parser/releases
2017-06-12 01:24:11 +00:00
2 changed files with 10 additions and 5 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "stream-http",
"version": "2.7.1",
"version": "2.7.2",
"description": "Streaming http in the browser",
"main": "index.js",
"repository": {
@@ -36,7 +36,7 @@
"devDependencies": {
"basic-auth": "^1.0.3",
"brfs": "^1.4.0",
"cookie-parser": "^1.3.5",
"cookie-parser": "^1.4.3",
"express": "^4.15.2",
"tape": "^4.0.0",
"ua-parser-js": "^0.7.7",
+8 -3
View File
@@ -93,6 +93,7 @@ var browserVersion = browser.major
var browserMinorVersion = browser.minor || 0
// The content-type header is broken when 'prefer-streaming' or 'allow-wrong-content-type'
// is passed in browsers that rely on xhr.overrideMimeType(), namely older chrome, safari 6-10.0, and the stock Android browser
// Note that Safari 10.0 on iOS 10.3 doesn't need to override the mime type, so the content-type is preserved.
var wrongMimeType = ((browserName === 'Chrome' && browserVersion <= 42) ||
((browserName === 'Safari' || browserName === 'Mobile Safari') && browserVersion >= 6 && (browserVersion < 10 || (browserVersion == 10 && browserMinorVersion == 0)))
|| (browserName === 'Android Browser'))
@@ -102,9 +103,13 @@ test('content-type response header with forced streaming', function (t) {
path: '/testHeaders',
mode: 'prefer-streaming'
}, function (res) {
if (wrongMimeType)
t.equal(res.headers['content-type'], 'text/plain; charset=x-user-defined', 'content-type overridden')
else
if (wrongMimeType) {
// allow both the 'wrong' and correct mime type, since sometimes it's impossible to tell which to expect
// from the browser version alone (e.g. Safari 10.0 on iOS 10.2 vs iOS 10.3)
var contentType = res.headers['content-type']
var correct = (contentType === 'text/plain; charset=x-user-defined') || (contentType === 'application/json')
t.ok(correct, 'content-type either preserved or overridden')
} else
t.equal(res.headers['content-type'], 'application/json', 'content-type preserved')
t.end()
})