Skip to content

Commit 82689d6

Browse files
committed
Merge tag '3.19.1'
2 parents 40f7a8e + 0c567b3 commit 82689d6

9 files changed

+189
-92
lines changed

History.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
unreleased
2+
==========
3+
4+
5+
- Fix root path disclosure
6+
17
4.11.0 / 2015-01-13
28
===================
39

@@ -657,6 +663,15 @@
657663
- `app.route()` - Proxy to the app's `Router#route()` method to create a new route
658664
- Router & Route - public API
659665

666+
3.19.1 / 2015-01-20
667+
===================
668+
669+
670+
- deps: body-parser@~1.10.2
671+
- deps: serve-static@~1.8.1
672+
673+
- Fix root path disclosure
674+
660675
3.19.0 / 2015-01-09
661676
===================
662677

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"proxy-addr": "~1.0.5",
4545
"qs": "2.3.3",
4646
"range-parser": "~1.0.2",
47-
"send": "0.11.0",
47+
"send": "0.11.1",
4848
"serve-static": "~1.8.0",
4949
"type-is": "~1.5.5",
5050
"vary": "~1.0.0",
@@ -54,10 +54,10 @@
5454
},
5555
"devDependencies": {
5656
"after": "0.8.1",
57-
"ejs": "2.0.8",
57+
"ejs": "2.1.4",
5858
"istanbul": "0.3.5",
5959
"mocha": "~2.1.0",
60-
"should": "~4.4.4",
60+
"should": "~4.6.1",
6161
"supertest": "~0.15.0",
6262
"marked": "0.3.2",
6363
"hjs": "~0.0.6",

test/req.fresh.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('req', function(){
3737
var app = express();
3838

3939
app.use(function(req, res){
40-
res._headers = undefined;
40+
res._headers = null;
4141
res.send(req.fresh);
4242
});
4343

test/req.stale.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('req', function(){
3737
var app = express();
3838

3939
app.use(function(req, res){
40-
res._headers = undefined;
40+
res._headers = null;
4141
res.send(req.stale);
4242
});
4343

test/res.format.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe('res', function(){
9999
it('should be invoked instead of auto-responding', function(done){
100100
request(app3)
101101
.get('/')
102-
.set('Accept: text/html')
102+
.set('Accept', 'text/html')
103103
.expect('default', done);
104104
})
105105
})

test/res.get.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11

2-
var express = require('../')
3-
, res = express.response;
2+
var express = require('..');
3+
var request = require('supertest');
44

55
describe('res', function(){
66
describe('.get(field)', function(){
7-
it('should get the response header field', function(){
8-
res.setHeader('Content-Type', 'text/x-foo');
9-
res.get('Content-Type').should.equal('text/x-foo');
10-
res.get('Content-type').should.equal('text/x-foo');
11-
res.get('content-type').should.equal('text/x-foo');
7+
it('should get the response header field', function (done) {
8+
var app = express();
9+
10+
app.use(function (req, res) {
11+
res.setHeader('Content-Type', 'text/x-foo');
12+
res.send(res.get('Content-Type'));
13+
});
14+
15+
request(app)
16+
.get('/')
17+
.expect(200, 'text/x-foo', done);
1218
})
1319
})
1420
})

test/res.links.js

+32-27
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,46 @@
11

2-
var express = require('../')
3-
, res = express.response;
2+
var express = require('..');
3+
var request = require('supertest');
44

55
describe('res', function(){
6-
7-
beforeEach(function() {
8-
res.removeHeader('link');
9-
});
10-
116
describe('.links(obj)', function(){
12-
it('should set Link header field', function(){
13-
res.links({
14-
next: 'http://api.example.com/users?page=2',
15-
last: 'http://api.example.com/users?page=5'
7+
it('should set Link header field', function (done) {
8+
var app = express();
9+
10+
app.use(function (req, res) {
11+
res.links({
12+
next: 'http://api.example.com/users?page=2',
13+
last: 'http://api.example.com/users?page=5'
14+
});
15+
res.end();
1616
});
1717

18-
res.get('link')
19-
.should.equal(
20-
'<http://api.example.com/users?page=2>; rel="next", '
21-
+ '<http://api.example.com/users?page=5>; rel="last"');
18+
request(app)
19+
.get('/')
20+
.expect('Link', '<http://api.example.com/users?page=2>; rel="next", <http://api.example.com/users?page=5>; rel="last"')
21+
.expect(200, done);
2222
})
2323

24-
it('should set Link header field for multiple calls', function() {
25-
res.links({
26-
next: 'http://api.example.com/users?page=2',
27-
last: 'http://api.example.com/users?page=5'
28-
});
24+
it('should set Link header field for multiple calls', function (done) {
25+
var app = express();
26+
27+
app.use(function (req, res) {
28+
res.links({
29+
next: 'http://api.example.com/users?page=2',
30+
last: 'http://api.example.com/users?page=5'
31+
});
32+
33+
res.links({
34+
prev: 'http://api.example.com/users?page=1'
35+
});
2936

30-
res.links({
31-
prev: 'http://api.example.com/users?page=1',
37+
res.end();
3238
});
3339

34-
res.get('link')
35-
.should.equal(
36-
'<http://api.example.com/users?page=2>; rel="next", '
37-
+ '<http://api.example.com/users?page=5>; rel="last", '
38-
+ '<http://api.example.com/users?page=1>; rel="prev"');
40+
request(app)
41+
.get('/')
42+
.expect('Link', '<http://api.example.com/users?page=2>; rel="next", <http://api.example.com/users?page=5>; rel="last", <http://api.example.com/users?page=1>; rel="prev"')
43+
.expect(200, done);
3944
})
4045
})
4146
})

test/res.set.js

+50-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

2-
var express = require('../')
3-
, request = require('supertest')
4-
, res = express.response;
2+
var express = require('..');
3+
var request = require('supertest');
54

65
describe('res', function(){
76
describe('.set(field, value)', function(){
@@ -18,10 +17,18 @@ describe('res', function(){
1817
.end(done);
1918
})
2019

21-
it('should coerce to a string', function(){
22-
res.headers = {};
23-
res.set('X-Number', 123);
24-
res.get('X-Number').should.equal('123');
20+
it('should coerce to a string', function (done) {
21+
var app = express();
22+
23+
app.use(function (req, res) {
24+
res.set('X-Number', 123);
25+
res.end(typeof res.get('X-Number'));
26+
});
27+
28+
request(app)
29+
.get('/')
30+
.expect('X-Number', '123')
31+
.expect(200, 'string', done);
2532
})
2633
})
2734

@@ -39,17 +46,32 @@ describe('res', function(){
3946
.expect('["type=ninja","language=javascript"]', done);
4047
})
4148

42-
it('should coerce to an array of strings', function(){
43-
res.headers = {};
44-
res.set('X-Numbers', [123, 456]);
45-
JSON.stringify(res.get('X-Numbers'))
46-
.should.equal('["123","456"]');
49+
it('should coerce to an array of strings', function (done) {
50+
var app = express();
51+
52+
app.use(function (req, res) {
53+
res.set('X-Numbers', [123, 456]);
54+
res.end(JSON.stringify(res.get('X-Numbers')));
55+
});
56+
57+
request(app)
58+
.get('/')
59+
.expect('X-Numbers', '123, 456')
60+
.expect(200, '["123","456"]', done);
4761
})
4862

49-
it('should not set a charset of one is already set', function () {
50-
res.headers = {};
51-
res.set('Content-Type', 'text/html; charset=lol');
52-
res.get('content-type').should.equal('text/html; charset=lol');
63+
it('should not set a charset of one is already set', function (done) {
64+
var app = express();
65+
66+
app.use(function (req, res) {
67+
res.set('Content-Type', 'text/html; charset=lol');
68+
res.end();
69+
});
70+
71+
request(app)
72+
.get('/')
73+
.expect('Content-Type', 'text/html; charset=lol')
74+
.expect(200, done);
5375
})
5476
})
5577

@@ -71,10 +93,18 @@ describe('res', function(){
7193
.end(done);
7294
})
7395

74-
it('should coerce to a string', function(){
75-
res.headers = {};
76-
res.set({ 'X-Number': 123 });
77-
res.get('X-Number').should.equal('123');
96+
it('should coerce to a string', function (done) {
97+
var app = express();
98+
99+
app.use(function (req, res) {
100+
res.set({ 'X-Number': 123 });
101+
res.end(typeof res.get('X-Number'));
102+
});
103+
104+
request(app)
105+
.get('/')
106+
.expect('X-Number', '123')
107+
.expect(200, 'string', done);
78108
})
79109
})
80110
})

0 commit comments

Comments
 (0)