mirror of
https://github.com/typicode/json-server.git
synced 2025-08-01 09:13:32 +08:00
Exposing Link
in the header instead of Links
(#394)
- fix the small typo `Links` to `Link` - update relevant tests
This commit is contained in:
@ -153,7 +153,7 @@ module.exports = function (db, name) {
|
||||
// Slice result
|
||||
if (_end || _limit || _page) {
|
||||
res.setHeader('X-Total-Count', chain.size())
|
||||
res.setHeader('Access-Control-Expose-Headers', 'X-Total-Count' + (_page ? ', Links' : ''))
|
||||
res.setHeader('Access-Control-Expose-Headers', 'X-Total-Count' + (_page ? ', Link' : ''))
|
||||
}
|
||||
|
||||
if (_page) {
|
||||
|
@ -261,7 +261,7 @@ describe('Server', function () {
|
||||
.get('/list?_page=2')
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('x-total-count', db.list.length.toString())
|
||||
.expect('Access-Control-Expose-Headers', 'X-Total-Count, Links')
|
||||
.expect('Access-Control-Expose-Headers', 'X-Total-Count, Link')
|
||||
.expect(db.list.slice(10, 20))
|
||||
.expect(200, done)
|
||||
})
|
||||
@ -281,7 +281,7 @@ describe('Server', function () {
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('x-total-count', db.list.length.toString())
|
||||
.expect('link', link)
|
||||
.expect('Access-Control-Expose-Headers', 'X-Total-Count, Links')
|
||||
.expect('Access-Control-Expose-Headers', 'X-Total-Count, Link')
|
||||
.expect(db.list.slice(1, 2))
|
||||
.expect(200, done)
|
||||
})
|
||||
|
Reference in New Issue
Block a user