Skip to content

Commit a47034b

Browse files
authored
Merge pull request #58 from greenkeeperio/fix/hook_limit_100
fix(npm-event): increase hooks limit to 100mb
2 parents 0dff510 + dbee44f commit a47034b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/npm-event.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function npmEvent (server, {env, channel}, next) {
1818
payload: {
1919
output: 'data',
2020
parse: false,
21-
maxBytes: 1024 * 1024 * 25 // = 25 MB
21+
maxBytes: 1024 * 1024 * 100 // = 100 MB
2222
}
2323
}
2424
})

test/npm-event.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,20 @@ const register = require('../lib/npm-event')
131131
payload: reqPayload
132132
})
133133
t.true((payloadSize > 1024 * 1024 * 1), 'payload is bigger then 1MB')
134-
t.true((payloadSize < 1024 * 1024 * 25), 'payload is smaller then 25MB')
134+
t.true((payloadSize < 1024 * 1024 * 100), 'payload is smaller then 100MB')
135135
t.is(statusCode, 202, 'statusCode')
136136
t.end()
137137
})
138138

139139
tap.test('does not accept packages that are bigger then 25MB', async (t) => {
140-
const bigBody = Buffer.alloc(1024 * 1024 * 5).toString()
140+
const bigBody = Buffer.alloc(1024 * 1024 * 5 * 4).toString()
141141
const reqPayload = JSON.stringify({
142142
payload: {
143143
body: bigBody
144144
}
145145
})
146146
// Because of the JSON.stringify() the payload with the 5MB Buffer actually
147-
// has a size of ~30MB
147+
// has a size of ~30MB * 4 ~= 120MB
148148
const payloadSize = reqPayload.length
149149

150150
server.register({
@@ -172,7 +172,7 @@ const register = require('../lib/npm-event')
172172
payload: reqPayload
173173
})
174174

175-
t.true((payloadSize > 1024 * 1024 * 25), 'payload is bigger then 25MB')
175+
t.true((payloadSize > 1024 * 1024 * 100), 'payload is bigger then 100MB')
176176
t.is(statusCode, 413, 'statusCode')
177177
t.end()
178178
})

0 commit comments

Comments
 (0)