Skip to content

Commit ed20d36

Browse files
committed
Add size limit config to the meta call
1 parent c6c09c3 commit ed20d36

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/model.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const helper = require('./helper');
2+
const config = require('./config');
23
const Data = require('./db').getInstance();
34

45
const xpost = async (req, res, next) => {
@@ -122,6 +123,7 @@ const xmeta = async (req, res, next) => {
122123
const result = {};
123124
Promise.all(promises).then(function(values) {
124125
result['_count'] = values[0];
126+
result['_sizeLimit'] = config.SIZE_LIMIT;
125127

126128
if (values[0] > 0) {
127129
// get first _createdOn

test/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const assert = require('assert');
22
const fetch = require('fetch-lite');
3+
const config = require('../src/config');
34

45
const apiBase = 'http://localhost:3000';
56
const random = (i, j) => Math.floor(Math.random() * j) + i;
@@ -61,6 +62,7 @@ describe('jsonbox.io tests', () => {
6162
});
6263
assert.equal(response.status, 200);
6364
assert.equal(response.body["_count"], 3);
65+
assert.equal(response.body["_sizeLimit"], config.SIZE_LIMIT);
6466
assert.notEqual(response.body["_createdOn"], undefined);
6567
});
6668
});

0 commit comments

Comments
 (0)