diff --git a/src/util.js b/src/util.js index 5dcb6c45..ce439c5f 100644 --- a/src/util.js +++ b/src/util.js @@ -162,8 +162,8 @@ export function sshonify(results, description, requestParams, truncated) { ':version': 3, results: { limit: Math.max(requestParams.limit || 1, results.length), - offset: requestParams.offset || 0, - total: requestParams.offset || 0 + results.length + (truncated ? 1 : 0), + offset: parseInt(requestParams.offset, 10) || 0, + total: results.length + Number(truncated), data: results, columns: Object.keys(results[0] || {}), }, diff --git a/test/testUtils.js b/test/testUtils.js index 53f5f6af..fc7d2b7d 100644 --- a/test/testUtils.js +++ b/test/testUtils.js @@ -372,8 +372,8 @@ describe('Test SSHONify', () => { }, results: { limit: 30, - offset: '0', - total: '0', + offset: 0, + total: 30, columns: [ 'checkpoint', 'source', @@ -520,8 +520,8 @@ describe('Test SSHONify', () => { }, results: { limit: 30, - offset: '0', - total: '0', + offset: 0, + total: 0, columns: [], data: [], },