Skip to content

Commit

Permalink
fix bodyParser express limit from iota config
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed May 6, 2024
1 parent 86d7cc4 commit a8fcee2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/bindings/HTTPBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ let httpBindingServer;
const transport = 'HTTP';

const { promisify } = require('util');
const json = promisify(bodyParser.json({ strict: false })); // accept anything JSON.parse accepts.
const text = promisify(bodyParser.text());
const raw = promisify(bodyParser.raw());
const json = promisify(bodyParser.json({ strict: false, limit: config.getConfig().iota.expressLimit })); // accept anything JSON.parse accepts.
const text = promisify(bodyParser.text({ limit: config.getConfig().iota.expressLimit }));
const raw = promisify(bodyParser.raw({ limit: config.getConfig().iota.expressLimit }));
const xml2js = require('xml2js');
const xmlStripPrefix = xml2js.processors.stripPrefix;
const xml = promisify(
Expand Down Expand Up @@ -681,7 +681,7 @@ function start(callback) {

httpBindingServer.router.post(
config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH,
bodyParser.json({ strict: false }), // accept anything JSON.parse accepts
bodyParser.json({ strict: false, limit: config.getConfig().iota.expressLimit }), // accept anything JSON.parse accepts
checkMandatoryParams(false),
parseDataMultipleMeasure,
addTimestamp,
Expand All @@ -704,7 +704,7 @@ function start(callback) {

httpBindingServer.router.post(
(config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_COMMANDS_PATH,
bodyParser.json({ strict: false }), // accept anything JSON.parse accepts.
bodyParser.json({ strict: false, limit: config.getConfig().iota.expressLimit }), // accept anything JSON.parse accepts.
checkMandatoryParams(false),
parseData,
addTimestamp,
Expand All @@ -715,7 +715,7 @@ function start(callback) {

httpBindingServer.router.post(
(config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_CONFIGURATION_PATH,
bodyParser.json({ strict: false }), // accept anything JSON.parse accepts.
bodyParser.json({ strict: false, limit: config.getConfig().iota.expressLimit }), // accept anything JSON.parse accepts.
checkMandatoryParams(false),
parseData,
handleConfigurationRequest
Expand Down

0 comments on commit a8fcee2

Please sign in to comment.