[Pkg-javascript-commits] [node-stream-http] 03/10: fix tests on Safari 10.0 on iOS 10.3

Bastien Roucariès rouca at moszumanska.debian.org
Sun Aug 20 13:54:26 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-stream-http.

commit 856a572341dd18ef4885d9502062f57bd46b8fc0
Author: John Hiesey <john at hiesey.com>
Date:   Mon Jun 12 13:01:14 2017 -0700

    fix tests on Safari 10.0 on iOS 10.3
---
 test/browser/headers.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/test/browser/headers.js b/test/browser/headers.js
index aee0f7b..9d0c77c 100644
--- a/test/browser/headers.js
+++ b/test/browser/headers.js
@@ -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()
 	})

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git



More information about the Pkg-javascript-commits mailing list