Skip to content

Commit 74d6ca0

Browse files
committed
Merge branch 'develop'
2 parents 4d1f581 + 8afe5e3 commit 74d6ca0

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

lib/server/responder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ var responder = {
9393
var host = req.headers.host;
9494
if (is_relative_path(url)) {
9595
url = url.replace(/^./, '');
96-
url = host + req.path + url;
96+
url = host + req.path() + url;
9797
} else if (url.match(/^\//)) {
9898
url = host + url; // a bit hacky
9999
} else {

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
},
99
"main": "./index",
1010
"dependencies": {
11-
"async": "0.1.22",
12-
"bunyan": "0.10.0",
11+
"async": "0.2.5",
12+
"bunyan": "0.21.1",
1313
"cli-color": "0.1.6",
1414
"optimist" : "0.3.5",
15-
"restify": "1.4.4",
15+
"restify": "2.4.1",
1616
"settings": "0.1.0"
1717
},
1818
"devDependencies": {
1919
"Faker" : "0.5.6",
20-
"jshint": "1.0.0",
20+
"jshint": "1.1.0",
2121
"istanbul": "0.1.29",
22-
"mocha": "1.8.1",
23-
"sinon": "1.5.2"
22+
"mocha": "1.9.0",
23+
"sinon": "1.6.0"
2424
},
2525
"repository": {
2626
"type": "git",

test/server/responder.functional.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ describe("functional - server/responder.js", function () {
144144

145145
context("when full path passed in without leading slash", function () {
146146
it("returns Internal error", function (done) {
147-
http_client.get('/test/redirects/full_path_without_leading_slash', function (err, result, raw_res) {
148-
assert.equal(err.code, 'Internal');
147+
http_client.get('/test/redirects/full_path_without_leading_slash', function (err) {
148+
assert.equal(err.body.code, 'InternalError');
149149
assert.ok(err.message.match(/leading slash/));
150150
done();
151151
});

test/server/responder.unit.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,20 @@ describe("responder.js", function () {
109109
});
110110
});
111111

112-
context("when request's protocol is https", function() {
113-
sinon.stub(fake_res, 'header');
112+
context("when request's protocol is https", function () {
113+
it("redirects with https protocol", function () {
114+
sinon.stub(fake_res, 'header');
114115

115-
var https_req = support.shallow_clone(fake_req);
116-
https_req.headers['x-forwarded-proto'] = 'https';
117-
var args = {url: '/foo/bar'};
116+
var https_req = support.shallow_clone(fake_req);
117+
https_req.headers['x-forwarded-proto'] = 'https';
118+
var args = {url: '/foo/bar'};
118119

119-
responder.redirect(https_req, fake_res, args, fake_next);
120+
responder.redirect(https_req, fake_res, args, fake_next);
120121

121-
assert.ok(fake_res.header.calledWith('Location', "https://local.foo.com/foo/bar"));
122+
assert.ok(fake_res.header.calledWith('Location', "https://local.foo.com/foo/bar"));
122123

123-
fake_res.header.restore();
124+
fake_res.header.restore();
125+
});
124126
});
125127
});
126128
});

test/server/router.unit.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ describe("server/router.js", function () {
4848

4949
describe("register_routes()", function () {
5050
it("adds routes to server", function () {
51-
assert.strictEqual(server.routes.length, 0);
51+
assert.strictEqual(Object.keys(server.routes).length, 0);
5252
assert.strictEqual(routes.length, 2);
5353

5454
router.register_routes(server, routes);
5555

56-
assert.strictEqual(server.routes.length, 2);
57-
assert.equal(server.routes[0].url, routes[0].url);
56+
assert.strictEqual(Object.keys(server.routes).length, 2);
57+
assert.ok(server.routes['gettestfoo']);
58+
assert.ok(server.routes['gettestbar']);
5859
});
5960

6061
it("throws error if routes are not an array", function () {

0 commit comments

Comments
 (0)