mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Followup to 7289950b: fix and add tests and comments.
7289950b removed the long-deprecated support for including "/sockjs" in
HTTP/HTTPS URLs passed to Meteor.connect (though it is require for the new
ddp+sockjs URLs), breaking some tests and making some comments incorrect. These
are now fixed.
This commit is contained in:
@@ -1152,13 +1152,12 @@ _.extend(Meteor._LivedataConnection.prototype, {
|
||||
});
|
||||
|
||||
_.extend(Meteor, {
|
||||
// @param url {String} URL to Meteor app, or to sockjs endpoint (deprecated),
|
||||
// @param url {String} URL to Meteor app,
|
||||
// e.g.:
|
||||
// "subdomain.meteor.com",
|
||||
// "http://subdomain.meteor.com",
|
||||
// "/",
|
||||
// "http://subdomain.meteor.com/sockjs" (deprecated),
|
||||
// "/sockjs" (deprecated)
|
||||
// "ddp+sockjs://ddp--****-foo.meteor.com/sockjs"
|
||||
connect: function (url, _reloadOnUpdate) {
|
||||
var ret = new Meteor._LivedataConnection(
|
||||
url, {reloadOnUpdate: _reloadOnUpdate});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// @param url {String} URL to Meteor app or sockjs endpoint (deprecated)
|
||||
// "http://subdomain.meteor.com/sockjs" or "/sockjs"
|
||||
// @param url {String} URL to Meteor app
|
||||
// "http://subdomain.meteor.com/" or "/" or
|
||||
// "ddp+sockjs://foo-**.meteor.com/sockjs"
|
||||
Meteor._Stream = function (url) {
|
||||
var self = this;
|
||||
|
||||
|
||||
@@ -35,36 +35,36 @@ testAsyncMulti("stream - reconnect", [
|
||||
|
||||
Tinytest.add("stream - sockjs urls are computed correctly", function(test) {
|
||||
var testHasSockjsUrl = function(raw, expectedSockjsUrl) {
|
||||
test.equal(Meteor._Stream._toSockjsUrl(raw), expectedSockjsUrl);
|
||||
var actual = Meteor._Stream._toSockjsUrl(raw);
|
||||
if (expectedSockjsUrl instanceof RegExp)
|
||||
test.isTrue(actual.match(expectedSockjsUrl));
|
||||
else
|
||||
test.equal(actual, expectedSockjsUrl);
|
||||
};
|
||||
|
||||
testHasSockjsUrl("http://subdomain.meteor.com/sockjs",
|
||||
"http://subdomain.meteor.com/sockjs");
|
||||
testHasSockjsUrl("http://subdomain.meteor.com/",
|
||||
"http://subdomain.meteor.com/sockjs");
|
||||
testHasSockjsUrl("http://subdomain.meteor.com",
|
||||
"http://subdomain.meteor.com/sockjs");
|
||||
testHasSockjsUrl("subdomain.meteor.com/sockjs",
|
||||
"http://subdomain.meteor.com/sockjs");
|
||||
testHasSockjsUrl("subdomain.meteor.com/",
|
||||
"http://subdomain.meteor.com/sockjs");
|
||||
testHasSockjsUrl("subdomain.meteor.com",
|
||||
"http://subdomain.meteor.com/sockjs");
|
||||
testHasSockjsUrl("/sockjs", "/sockjs");
|
||||
testHasSockjsUrl("/", "/sockjs");
|
||||
|
||||
testHasSockjsUrl("http://localhost:3000/sockjs",
|
||||
"http://localhost:3000/sockjs");
|
||||
testHasSockjsUrl("http://localhost:3000/", "http://localhost:3000/sockjs");
|
||||
testHasSockjsUrl("http://localhost:3000", "http://localhost:3000/sockjs");
|
||||
testHasSockjsUrl("localhost:3000", "http://localhost:3000/sockjs");
|
||||
|
||||
testHasSockjsUrl("https://subdomain.meteor.com/sockjs",
|
||||
"https://subdomain.meteor.com/sockjs");
|
||||
testHasSockjsUrl("https://subdomain.meteor.com/",
|
||||
"https://subdomain.meteor.com/sockjs");
|
||||
testHasSockjsUrl("https://subdomain.meteor.com",
|
||||
"https://subdomain.meteor.com/sockjs");
|
||||
|
||||
testHasSockjsUrl("ddp+sockjs://ddp--****-foo.meteor.com/sockjs",
|
||||
/^https:\/\/ddp--\d\d\d\d-foo\.meteor\.com\/sockjs$/);
|
||||
testHasSockjsUrl("ddpi+sockjs://ddp--****-foo.meteor.com/sockjs",
|
||||
/^http:\/\/ddp--\d\d\d\d-foo\.meteor\.com\/sockjs$/);
|
||||
});
|
||||
|
||||
testAsyncMulti("stream - /websocket is a websocket endpoint", [
|
||||
|
||||
Reference in New Issue
Block a user