Comparing version 1.0.4 to 1.0.5
@@ -115,3 +115,3 @@ | ||
// Mozilla always adds an entry to the history | ||
if (mode === 'legacy') { | ||
if (this.mode === 'legacy') { | ||
this.writeFrame(s); | ||
@@ -118,0 +118,0 @@ } |
@@ -201,3 +201,3 @@ /* | ||
if (path.source) { | ||
path = path.source; | ||
path = path.source.replace(/\\\//ig, '/'); | ||
} | ||
@@ -225,3 +225,3 @@ | ||
if (path.source) { | ||
path = path.source; | ||
path = path.source.replace(/\\\//ig, '/'); | ||
} | ||
@@ -228,0 +228,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"author": "Nodejitsu Inc <info@nodejitsu.com>", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"maintainers": [ "hij1nx <hij1nx@me.com>", "indexzero <charlie.robbins@gmail.com>" ], | ||
@@ -23,6 +23,7 @@ "contributors": [ | ||
"codesurgeon": "0.2.x", | ||
"colors": "0.5.x", | ||
"eyes": "0.1.x", | ||
"uglify-js": "1.0.6", | ||
"vows": "0.5.x", | ||
"colors": "0.5.x" | ||
"request": "2.0.x", | ||
"vows": "0.5.x" | ||
}, | ||
@@ -29,0 +30,0 @@ "ender": "./build/ender.js", |
@@ -617,1 +617,17 @@ | ||
}); | ||
createTest('setRoute with a single parameter should change location correctly', { | ||
'/bonk': { | ||
on: function() { | ||
shared.fired.push(window.location.hash); | ||
} | ||
} | ||
}, function() { | ||
var self = this; | ||
shared.fired = []; | ||
this.router.setRoute('/bonk'); | ||
setTimeout(function() { | ||
deepEqual(shared.fired, ['#/bonk']); | ||
self.finish(); | ||
}, 14) | ||
}); |
@@ -12,9 +12,34 @@ /* | ||
vows = require('vows'), | ||
request = require('request'), | ||
director = require('../../../lib/director'); | ||
function helloWorld(route) { | ||
function helloWorld(id) { | ||
this.res.writeHead(200, { 'Content-Type': 'text/plain' }) | ||
this.res.end('hello world from (' + route + ')'); | ||
} | ||
this.res.end('hello from (' + id + ')'); | ||
} | ||
function createServer (router) { | ||
return http.createServer(function (req, res) { | ||
router.dispatch(req, res, function (err) { | ||
if (err) { | ||
res.writeHead(404); | ||
res.end(); | ||
} | ||
}); | ||
}); | ||
} | ||
function assertGet (uri) { | ||
return { | ||
topic: function () { | ||
request({ uri: 'http://localhost:9090/' + uri }, this.callback); | ||
}, | ||
"should respond with `hello from (bark)`": function (err, res, body) { | ||
assert.isNull(err); | ||
assert.equal(res.statusCode, 200); | ||
assert.equal(body, 'hello from (bark)') | ||
} | ||
} | ||
} | ||
vows.describe('director/server/http').addBatch({ | ||
@@ -31,2 +56,17 @@ "An instance of director.http.Router": { | ||
assert.isFunction(router.routes.hello.get); | ||
}, | ||
"when passed to an http.Server instance": { | ||
topic: function (router) { | ||
router.get(/foo\/bar\/(\w+)/, helloWorld); | ||
router.path(/bar\/bazz\//, function () { | ||
this.get(/(\w+)/, helloWorld) | ||
}); | ||
var server = createServer(router), | ||
that = this; | ||
server.listen(9090, this.callback); | ||
}, | ||
"a request to foo/bar/bark": assertGet('foo/bar/bark'), | ||
"a request to bar/bazz/bark": assertGet('bar/bazz/bark') | ||
} | ||
@@ -33,0 +73,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
235016
3706
2
6