diff --git a/lib/apiswagger.js b/lib/apiswagger.js index dcee05c..dcb9bbe 100644 --- a/lib/apiswagger.js +++ b/lib/apiswagger.js @@ -473,12 +473,12 @@ module.exports = (app, client) => { parser(), pick({ filter: 'hits.hits' }), streamArray(), - data => ({ instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment }), - stringer() + data => ({ instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment }) ]) - res.once('data', data => '[' + data.toString()) - res.on('finish', () => res.end(']')) - result.pipe(pipeline).pipe(res) + result.on('readable', () => res.write('[')) + pipeline.on('data', data => res.write(data.toString() + ',')) + pipeline.on('finish', () => res.end(']')) + result.pipe(pipeline) } else { res.status(404).end() }