koa-pagination
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -1,35 +0,75 @@ | ||
## Changelog | ||
# Changelog | ||
### 1.0.0 / 2015-12-10 | ||
- [#25](https://github.com/seegno/koa-pagination/pull/25) Remove usage of `chai` (@franciscocardoso) | ||
- [#24](https://github.com/seegno/koa-pagination/pull/24) Prevent usage of unsafe numbers (@franciscocardoso) | ||
- [#23](https://github.com/seegno/koa-pagination/pull/23) Replace `create-error` with `standard-http-error` (@franciscocardoso) | ||
## [v1.1.0](https://github.com/seegno/koa-pagination/tree/v1.1.0) (2016-05-04) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v1.0.0...v1.1.0) | ||
### 0.3.1 / 2015-02-26 | ||
- [#21](https://github.com/seegno/koa-pagination/pull/21) Fix readme headers example (@nunorafaelrocha) | ||
**Merged pull requests:** | ||
### 0.3.0 / 2015-02-09 | ||
- [#20](https://github.com/seegno/koa-pagination/pull/20) Change default unit to `items` (@fixe) | ||
- [#19](https://github.com/seegno/koa-pagination/pull/19) Allow specifying `unit` option (@fixe) | ||
- Update changelog and version scripts [\#28](https://github.com/seegno/koa-pagination/pull/28) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
- Improve error message [\#27](https://github.com/seegno/koa-pagination/pull/27) ([ruimarinho](https://github.com/ruimarinho)) | ||
- Expose `range-unit` [\#26](https://github.com/seegno/koa-pagination/pull/26) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
### 0.2.0 / 2015-02-03 | ||
- [#18](https://github.com/seegno/koa-pagination/pull/18) Update response status (@franciscocardoso) | ||
## [v1.0.0](https://github.com/seegno/koa-pagination/tree/v1.0.0) (2015-12-10) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v0.3.1...v1.0.0) | ||
### 0.1.3 / 2015-02-02 | ||
- [#13](https://github.com/seegno/koa-pagination/pull/13) Add codeclimate `gpa` and `coverage` badges (@franciscocardoso) | ||
- [#14](https://github.com/seegno/koa-pagination/pull/14) Add npm badge (@fixe) | ||
- [#12](https://github.com/seegno/koa-pagination/pull/12) Rename test file to `index_test` (@franciscocardoso) | ||
- [#11](https://github.com/seegno/koa-pagination/pull/11) Fix error in example `content-range` value (@franciscocardoso) | ||
**Merged pull requests:** | ||
### 0.1.2 / 2015-01-29 | ||
- [#10](https://github.com/seegno/koa-pagination/pull/10) Fix github repository name (@franciscocardoso) | ||
- Remove usage of `chai` [\#25](https://github.com/seegno/koa-pagination/pull/25) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
- Prevent usage of unsafe numbers [\#24](https://github.com/seegno/koa-pagination/pull/24) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
- Replace `create-error` with `standard-http-error` [\#23](https://github.com/seegno/koa-pagination/pull/23) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
### 0.1.1 / 2015-01-29 | ||
- [#9](https://github.com/seegno/koa-pagination/pull/9) Fix pagination limit value (@franciscocardoso) | ||
## [v0.3.1](https://github.com/seegno/koa-pagination/tree/v0.3.1) (2015-02-26) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v0.3.0...v0.3.1) | ||
### 0.1.0 / 2015-01-28 | ||
- [#8](https://github.com/seegno/koa-pagination/pull/8) Fix `limit` and `offset` interpretation (@franciscocardoso) | ||
- [#7](https://github.com/seegno/koa-pagination/pull/7) Fix count in README (@fixe) | ||
- [#5](https://github.com/seegno/koa-pagination/pull/5) Update README (@franciscocardoso) | ||
- [#6](https://github.com/seegno/koa-pagination/pull/6) Remove non existent precommit configurations (@franciscocardoso) | ||
- [#4](https://github.com/seegno/koa-pagination/pull/4) Add Travis (@fixe) | ||
**Merged pull requests:** | ||
- Fix readme headers example [\#21](https://github.com/seegno/koa-pagination/pull/21) ([nunorafaelrocha](https://github.com/nunorafaelrocha)) | ||
## [v0.3.0](https://github.com/seegno/koa-pagination/tree/v0.3.0) (2015-02-09) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v0.2.0...v0.3.0) | ||
**Merged pull requests:** | ||
- Change default unit to `items` [\#20](https://github.com/seegno/koa-pagination/pull/20) ([fixe](https://github.com/fixe)) | ||
- Allow specifying `unit` option [\#19](https://github.com/seegno/koa-pagination/pull/19) ([fixe](https://github.com/fixe)) | ||
## [v0.2.0](https://github.com/seegno/koa-pagination/tree/v0.2.0) (2015-02-03) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v0.1.3...v0.2.0) | ||
**Merged pull requests:** | ||
- Update response status [\#18](https://github.com/seegno/koa-pagination/pull/18) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
## [v0.1.3](https://github.com/seegno/koa-pagination/tree/v0.1.3) (2015-02-02) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v0.1.2...v0.1.3) | ||
**Merged pull requests:** | ||
- Add npm badge [\#14](https://github.com/seegno/koa-pagination/pull/14) ([fixe](https://github.com/fixe)) | ||
- Add codeclimate `gpa` and `coverage` badges [\#13](https://github.com/seegno/koa-pagination/pull/13) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
- Rename test file to `index\_test` [\#12](https://github.com/seegno/koa-pagination/pull/12) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
- Fix error in example `content-range` value [\#11](https://github.com/seegno/koa-pagination/pull/11) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
## [v0.1.2](https://github.com/seegno/koa-pagination/tree/v0.1.2) (2015-01-29) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v0.1.1...v0.1.2) | ||
**Merged pull requests:** | ||
- Fix github repository name [\#10](https://github.com/seegno/koa-pagination/pull/10) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
## [v0.1.1](https://github.com/seegno/koa-pagination/tree/v0.1.1) (2015-01-29) | ||
[Full Changelog](https://github.com/seegno/koa-pagination/compare/v0.1.0...v0.1.1) | ||
**Merged pull requests:** | ||
- Fix pagination limit value [\#9](https://github.com/seegno/koa-pagination/pull/9) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
## [v0.1.0](https://github.com/seegno/koa-pagination/tree/v0.1.0) (2015-01-28) | ||
**Merged pull requests:** | ||
- Fix `limit` and `offset` interpretation [\#8](https://github.com/seegno/koa-pagination/pull/8) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
- Fix count in README [\#7](https://github.com/seegno/koa-pagination/pull/7) ([fixe](https://github.com/fixe)) | ||
- Remove non existent precommit configurations [\#6](https://github.com/seegno/koa-pagination/pull/6) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
- Update README [\#5](https://github.com/seegno/koa-pagination/pull/5) ([franciscocardoso](https://github.com/franciscocardoso)) | ||
- Add Travis [\#4](https://github.com/seegno/koa-pagination/pull/4) ([fixe](https://github.com/fixe)) | ||
- Add range parser modules [\#3](https://github.com/seegno/koa-pagination/pull/3) ([franciscocardoso](https://github.com/franciscocardoso)) |
@@ -13,4 +13,4 @@ | ||
function MalformedRangeError(message, properties) { | ||
HttpError.call(this, 412, message, properties); | ||
function MalformedRangeError() { | ||
HttpError.call(this, 412, 'Malformed Range Error'); | ||
} | ||
@@ -17,0 +17,0 @@ |
@@ -13,4 +13,4 @@ | ||
function RangeNotSatisfiableError(message, properties) { | ||
HttpError.call(this, 416, message, properties); | ||
function RangeNotSatisfiableError() { | ||
HttpError.call(this, 416); | ||
} | ||
@@ -17,0 +17,0 @@ |
@@ -65,3 +65,4 @@ | ||
limit: last - first + 1, | ||
offset: first | ||
offset: first, | ||
unit: unit | ||
}; | ||
@@ -85,4 +86,4 @@ | ||
if (length === 0) { | ||
first = undefined; | ||
last = undefined; | ||
first = undefined; | ||
last = undefined; | ||
} | ||
@@ -89,0 +90,0 @@ |
{ | ||
"name": "koa-pagination", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Koa Pagination", | ||
"license": "MIT", | ||
"author": "Seegno", | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">= v0.11.13" | ||
"repository": "git@github.com:seegno/koa-pagination", | ||
"scripts": { | ||
"changelog": "github_changelog_generator --no-issues --header-label='# Changelog' --future-release=v$npm_config_future_release && sed -i '' -e :a -e '$d;N;2,4ba' -e 'P;D' CHANGELOG.md", | ||
"test": "NODE_ENV=test ./node_modules/.bin/mocha --harmony-generators --recursive test", | ||
"version": "npm run changelog --future-release=$npm_package_version && git add -A CHANGELOG.md" | ||
}, | ||
@@ -28,12 +33,9 @@ "dependencies": { | ||
"precommit-hook": "1.0.7", | ||
"should": "^8.3.1", | ||
"supertest": "0.15.0", | ||
"test": "0.6.0" | ||
}, | ||
"scripts": { | ||
"changelog": "./node_modules/.bin/github-changes -o seegno -r koa-pagination -a --only-pulls --use-commit-body --title 'Changelog' --date-format '/ YYYY-MM-DD'", | ||
"test": "NODE_ENV=test ./node_modules/.bin/mocha --harmony-generators test/*_test.js" | ||
}, | ||
"author": "Seegno", | ||
"license": "MIT", | ||
"repository": "git@github.com:seegno/koa-pagination" | ||
"engines": { | ||
"node": ">= v0.11.13" | ||
} | ||
} |
@@ -295,2 +295,18 @@ | ||
it('should expose the given `range-unit`', function *() { | ||
var app = koa(); | ||
app.use(paginate({ unit: 'bytes' })); | ||
app.use(function *() { | ||
this.pagination.unit.should.equal('foobar'); | ||
}); | ||
yield request(app.listen()) | ||
.get('/') | ||
.set('Range', 'foobar=0-5') | ||
.expect('Content-Range', 'foobar 0-5/*') | ||
.end(); | ||
}); | ||
it('should set the `byte-range-spec` to `*` if length is 0', function *() { | ||
@@ -297,0 +313,0 @@ var app = koa(); |
Sorry, the diff of this file is not supported yet
24278
17
451
12