Actually make multiplart also optional
This commit is contained in:
+5
-2
@@ -45,9 +45,12 @@ async function initializeExpressSync() {
|
||||
const QUERY_LIMIT = '2mb', // max size for json queries (see also client_max_body_size in nginx)
|
||||
FIELD_LIMIT = 2 * 1024 * 1024; // max fields that can appear in multipart
|
||||
|
||||
const multipart = middleware.multipart({ maxFieldsSize: FIELD_LIMIT, limit: FILE_SIZE_LIMIT, timeout: FILE_TIMEOUT });
|
||||
const multipart = middleware.multipart({ maxFieldsSize: FIELD_LIMIT, limit: FILE_SIZE_LIMIT, timeout: FILE_TIMEOUT }, true); // forces multipart content-type
|
||||
const json = middleware.json({ strict: true, limit: QUERY_LIMIT }, true); // forces json content-type
|
||||
const jsonOrMultipart = [ middleware.json({ strict: true, limit: QUERY_LIMIT }, false), multipart ];
|
||||
const jsonOrMultipart = [
|
||||
middleware.json({ strict: true, limit: QUERY_LIMIT }, false),
|
||||
middleware.multipart({ maxFieldsSize: FIELD_LIMIT, limit: FILE_SIZE_LIMIT, timeout: FILE_TIMEOUT }, false)
|
||||
];
|
||||
|
||||
app.set('json spaces', 2); // pretty json
|
||||
app.enable('trust proxy'); // trust the X-Forwarded-* headers
|
||||
|
||||
Reference in New Issue
Block a user