Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jun 13, 2016
1 parent c762b16 commit fc40702
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
18 changes: 18 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
unreleased
==========

* Add `acceptRanges` option to `res.sendFile`/`res.sendfile`
* Add `cacheControl` option to `res.sendFile`/`res.sendfile`
* Add `options` argument to `req.range`
- Includes the `combine` option
* Fix some redirect handling in `res.sendFile`/`res.sendfile`
* Fix Windows absolute path check using forward slashes
* Improve error with invalid arguments to `req.get()`
* Improve performance for `res.json`/`res.jsonp` in most cases
* Improve `Range` header handling in `res.sendFile`/`res.sendfile`
* deps: accepts@~1.3.3
- Fix including type extensions in parameters in `Accept` parsing
- Fix parsing `Accept` parameters with quoted equals
Expand Down Expand Up @@ -38,6 +42,20 @@ unreleased
- Add `combine` option to combine overlapping ranges
- Fix incorrectly returning -1 when there is at least one valid range
- perf: remove internal function
* deps: [email protected]
- Add `acceptRanges` option
- Add `cacheControl` option
- Attempt to combine multiple ranges into single range
- Correctly inherit from `Stream` class
- Fix `Content-Range` header in 416 responses when using `start`/`end` options
- Fix `Content-Range` header missing from default 416 responses
- Fix redirect error when `path` contains raw non-URL characters
- Fix redirect when `path` starts with multiple forward slashes
- Ignore non-byte `Range` headers
- deps: http-errors@~1.5.0
- deps: range-parser@~1.2.0
- deps: statuses@~1.3.0
- perf: remove argument reassignment
* deps: type-is@~1.6.13
- Fix type error when given invalid type to match against
- deps: mime-types@~2.1.11
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"proxy-addr": "~1.1.2",
"qs": "6.2.0",
"range-parser": "~1.2.0",
"send": "0.13.1",
"send": "0.14.1",
"serve-static": "~1.10.2",
"type-is": "~1.6.13",
"utils-merge": "1.0.0",
Expand Down
22 changes: 22 additions & 0 deletions test/res.sendFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,14 @@ describe('res', function(){
})
})

describe('.sendFile(path, options)', function () {
it('should pass options to send module', function (done) {
request(createApp(path.resolve(fixtures, 'name.txt'), { start: 0, end: 1 }))
.get('/')
.expect(200, 'to', done)
})
})

describe('.sendfile(path, fn)', function(){
it('should invoke the callback when complete', function(done){
var app = express();
Expand Down Expand Up @@ -702,6 +710,20 @@ describe('res', function(){
})
})

describe('.sendfile(path, options)', function () {
it('should pass options to send module', function (done) {
var app = express()

app.use(function (req, res) {
res.sendfile(path.resolve(fixtures, 'name.txt'), { start: 0, end: 1 })
})

request(app)
.get('/')
.expect(200, 'to', done)
})
})

function createApp(path, options, fn) {
var app = express();

Expand Down

0 comments on commit fc40702

Please sign in to comment.