mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-04 04:22:50 +00:00
committed by
Rainer Killinger
parent
eabd885cd4
commit
d110d60123
@@ -14,6 +14,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCConfigFile,
|
||||
SCNotFoundErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
@@ -40,6 +41,7 @@ import {Elasticsearch} from './storage/elasticsearch/Elasticsearch';
|
||||
|
||||
export const app = express();
|
||||
const isTestEnvironment = process.env.NODE_ENV !== 'production';
|
||||
const configFile: SCConfigFile = app.get('config');
|
||||
|
||||
async function configureApp() {
|
||||
// request loggers have to be the first middleware to be set in express
|
||||
@@ -73,7 +75,7 @@ async function configureApp() {
|
||||
const chunkGatherer = (chunk: Buffer) => {
|
||||
bodySize += chunk.byteLength;
|
||||
// when adding each chunk size to the total size, check how large it now is.
|
||||
if (bodySize > 512 * 1024) {
|
||||
if (bodySize > configFile.backend.maxRequestBodySize) {
|
||||
req.off('data', chunkGatherer);
|
||||
req.off('end', endCallback);
|
||||
// return an error in the response
|
||||
|
||||
Reference in New Issue
Block a user