Skip to content

Commit adc19a5

Browse files
committed
Update lab
1 parent 7756460 commit adc19a5

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ coverage.*
77
**/._*
88

99
**/*.pem
10+
11+
**/.vs
12+
**/.vscode
13+
**/.idea

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2012-2018, Project contributors
1+
Copyright (c) 2012-2019, Project contributors
22
Copyright (c) 2012-2014, Walmart
33
All rights reserved.
44

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"devDependencies": {
2222
"code": "5.x.x",
2323
"form-data": "2.1.x",
24-
"lab": "17.x.x"
24+
"lab": "18.x.x"
2525
},
2626
"scripts": {
2727
"test": "lab -a code -t 100 -L",

test/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,18 @@ describe('parse()', () => {
169169
await expect(Subtext.parse(request, null, { parse: false, output: 'data', maxBytes: 10 })).to.reject('Payload content length greater than maximum allowed: 10');
170170
});
171171

172+
it('validates maxBytes when content is within limit', async () => {
173+
174+
const body = '{"x":"1","y":"2","z":"3"}';
175+
const request = Wreck.toReadableStream(body);
176+
request.headers = {
177+
'content-length': '50',
178+
'content-type': 'application/json'
179+
};
180+
181+
await expect(Subtext.parse(request, null, { parse: false, output: 'data', maxBytes: 100 })).to.not.reject();
182+
});
183+
172184
it('errors on invalid JSON payload', async () => {
173185

174186
const body = '{"x":"1","y":"2","z":"3"';

0 commit comments

Comments
 (0)