Skip to content

Commit cccec2e

Browse files
committed
add infinite body size limit jsreport/jsreport#752
1 parent d51769f commit cccec2e

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

lib/client.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class Client {
3636
'Content-Type': 'application/json'
3737
},
3838
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
39-
responseType: 'stream'
39+
responseType: 'stream',
40+
maxContentLength: Infinity,
41+
maxBodyLength: Infinity
4042
}, options)
4143

4244
if (username) {

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/clientTest.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,23 @@ describe('testing client', () => {
7474
}
7575
}, { timeout: 100 }).should.be.rejected()
7676
})
77+
78+
it('should have infinite body size limit', async () => {
79+
const data = { foo: 'foo', people: [] }
80+
81+
for (var i = 0; i < 2000000; i++) {
82+
data.people.push(i)
83+
}
84+
85+
await client(url).render({
86+
template: {
87+
content: 'hello',
88+
recipe: 'html',
89+
engine: 'jsrender'
90+
},
91+
data
92+
})
93+
}).timeout(10000)
7794
})
7895

7996
describe('testing client with authentication', () => {
@@ -123,5 +140,5 @@ describe('testing client without connection', () => {
123140
return client('http://localhost:9849').render({
124141
template: { content: 'hello', recipe: 'html' }
125142
}).should.be.rejected()
126-
})
143+
}).timeout(10000)
127144
})

0 commit comments

Comments
 (0)