Skip to content

Commit

Permalink
HOF 817 Increase the payload size
Browse files Browse the repository at this point in the history
- Body parser incoming request bodies in a middleware by default has a limit set to 100kb which is small for the request body sent over each form service. Every form service has a generic request body size, The aim is to enable each service to pass the required body size from project level .

- Set the limit for both Json and urlencode as a parameter from the project level, the values will be declared the .env file of each project.

- make a modification in the lib/setting.js  and config/hof-default.js file
  • Loading branch information
TemitopeAyokuHO committed Jul 24, 2024
1 parent 59aa6be commit 02a3633
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config/hof-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const defaults = {
env: process.env.NODE_ENV || 'development',
gaTagId: process.env.GA_TAG || 'Test-GA-Tag',
ga4TagId: process.env.GA_4_TAG,
urlEncodedLimitSize: process.env.URL_ENCODED_LIMIT_SIZE || '100kb',
jsonLimitSize: process.env.JSON_LIMIT_SIZE || '100kb',
// added to allow support for multiple HOF forms using GTM to customize how they track page views
gtm: {
tagId: process.env.GTM_TAG || false,
Expand Down
4 changes: 2 additions & 2 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ module.exports = async (app, config) => {
app.engine(viewEngine, hoganExpressStrict);

app.use(bodyParser.urlencoded({
limit: '50mb',
limit: config.urlEncodedLimitSize,
extended: true
}));

app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.json({limit: config.jsonLimitSize}));

app.use((req, res, next) => {
res.locals.baseUrl = req.baseUrl;
Expand Down

0 comments on commit 02a3633

Please sign in to comment.