forked from tableflip/smartsurvey-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
response-meta.js
33 lines (26 loc) · 896 Bytes
/
response-meta.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
exports.parse = function (res) {
var meta = {}
if (res.headers['x-ss-pagination-page']) {
meta.pagination = meta.pagination || {}
meta.pagination.page = res.headers['x-ss-pagination-page']
}
if (res.headers['x-ss-pagination-pagesize']) {
meta.pagination = meta.pagination || {}
meta.pagination.pageSize = res.headers['x-ss-pagination-pagesize']
}
if (res.headers['x-ss-pagination-returned']) {
meta.pagination = meta.pagination || {}
meta.pagination.returned = res.headers['x-ss-pagination-returned']
}
if (res.headers['x-ss-pagination-total']) {
meta.pagination = meta.pagination || {}
meta.pagination.total = res.headers['x-ss-pagination-total']
}
if (res.headers['x-ss-release']) {
meta.release = res.headers['x-ss-release']
}
if (res.headers['x-ss-server']) {
meta.server = res.headers['x-ss-server']
}
return meta
}