From 8200af5bb541d4b94fc184b1a4c45c767d57b647 Mon Sep 17 00:00:00 2001 From: Mike Bland Date: Mon, 22 Jun 2015 10:10:34 -0400 Subject: [PATCH 1/2] Pass through bodyParser.json() middleware options As noted in #14, the default 100KB payload limit was exceeded by a webhook fired for 18F/govt-wide-patternlibrary#54. Combined with 5d2ee1ec4899e8f4ff0e0f54bb16ac745df6d144 from 18F/hookshot, this change will allow us to pass options through to the bodyParser.json() middleware to increase the limit. --- hookshot.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hookshot.js b/hookshot.js index f46c6da..a77cf41 100644 --- a/hookshot.js +++ b/hookshot.js @@ -192,17 +192,21 @@ function launch_builder(info, dest_dir, repo_dir) { builder.build(); } +// Passed through to bodyParser.json(). +// See https://www.npmjs.com/package/bytes for `limit:` syntax. +var json_options = { limit: 1 << 20 }; + var webhook = hookshot('refs/heads/18f-pages', function(info) { launch_builder(info, path.join(home, "pages-generated"), path.join(home, "pages-repos")); -}); +}, json_options); webhook.on('refs/heads/18f-pages-staging', function(info) { launch_builder(info, path.join(home, "pages-staging"), path.join(home, "pages-repos-staging")); -}); +}, json_options); webhook.listen(port); From abbd991cc41cc259bbb119ae4efecbd2c5c30285 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Mon, 22 Jun 2015 12:32:13 -0400 Subject: [PATCH 2/2] fix URL for body-parser --- hookshot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hookshot.js b/hookshot.js index a77cf41..70e824d 100644 --- a/hookshot.js +++ b/hookshot.js @@ -193,7 +193,7 @@ function launch_builder(info, dest_dir, repo_dir) { } // Passed through to bodyParser.json(). -// See https://www.npmjs.com/package/bytes for `limit:` syntax. +// https://www.npmjs.com/package/body-parser#limit var json_options = { limit: 1 << 20 }; var webhook = hookshot('refs/heads/18f-pages', function(info) {