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