Skip to content

Commit d9c5e27

Browse files
committed
1 parent 843d1ea commit d9c5e27

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

HISTORY.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
unreleased
2+
==========
3+
4+
5+
- Add 70 new types for file extensions
6+
- Add `immutable` option
7+
- Fix missing `</html>` in default error & redirects
8+
- Set charset as "UTF-8" for .js and .json
9+
- Use instance methods on steam to check for listeners
10+
11+
- perf: improve path validation speed
12+
113
1.12.6 / 2017-09-22
214
===================
315

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ of the `Range` request header.
4444
##### cacheControl
4545

4646
Enable or disable setting `Cache-Control` response header, defaults to
47-
true. Disabling this will ignore the `maxAge` option.
47+
true. Disabling this will ignore the `immutable` and `maxAge` options.
4848

4949
##### dotfiles
5050

@@ -93,6 +93,14 @@ all methods.
9393

9494
The default value is `true`.
9595

96+
##### immutable
97+
98+
Enable or diable the `immutable` directive in the `Cache-Control` response
99+
header, defaults to `false`. If set to `true`, the `maxAge` option should
100+
also be specified to enable caching. The `immutable` directive will prevent
101+
supported clients from making conditional requests during the life of the
102+
`maxAge` option to check if the file has changed.
103+
96104
##### index
97105

98106
By default this module will send "index.html" files in response to a request

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"encodeurl": "~1.0.1",
1010
"escape-html": "~1.0.3",
1111
"parseurl": "~1.3.2",
12-
"send": "0.15.6"
12+
"send": "0.16.0"
1313
},
1414
"devDependencies": {
1515
"eslint": "3.19.0",

test/test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,20 @@ describe('serveStatic()', function () {
403403
})
404404
})
405405

406+
describe('immutable', function () {
407+
it('should default to false', function (done) {
408+
request(createServer(fixtures))
409+
.get('/nums')
410+
.expect('Cache-Control', 'public, max-age=0', done)
411+
})
412+
413+
it('should set immutable directive in Cache-Control', function (done) {
414+
request(createServer(fixtures, {'immutable': true, 'maxAge': '1h'}))
415+
.get('/nums')
416+
.expect('Cache-Control', 'public, max-age=3600, immutable', done)
417+
})
418+
})
419+
406420
describe('lastModified', function () {
407421
describe('when false', function () {
408422
it('should not include Last-Modifed', function (done) {

0 commit comments

Comments
 (0)