c2-http 1.0.171 → 1.0.172
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,7 +8,7 @@ const c2_util_1 = require("c2-util");
|
|
|
8
8
|
const http_status_1 = require("http-status");
|
|
9
9
|
// import moment from "moment";
|
|
10
10
|
class MiddlewareBody {
|
|
11
|
-
LIMIT_BYTES = 1024 * 1024; //
|
|
11
|
+
LIMIT_BYTES = 1024 * 1024 * 25; // 25MB
|
|
12
12
|
config(expressApplication) {
|
|
13
13
|
// Middleware para verificar tamanho da requisição ANTES do body-parser processar
|
|
14
14
|
expressApplication.use((request, response, next) => {
|
|
@@ -33,11 +33,11 @@ class MiddlewareBody {
|
|
|
33
33
|
}
|
|
34
34
|
next();
|
|
35
35
|
});
|
|
36
|
-
expressApplication.use(body_parser_1.default.json({ limit: "
|
|
37
|
-
expressApplication.use(body_parser_1.default.urlencoded({ limit: "
|
|
38
|
-
expressApplication.use(body_parser_1.default.text({ limit: "
|
|
36
|
+
expressApplication.use(body_parser_1.default.json({ limit: "25mb" }));
|
|
37
|
+
expressApplication.use(body_parser_1.default.urlencoded({ limit: "25mb", extended: true })); // Aumentar de 5mb para 25mb
|
|
38
|
+
expressApplication.use(body_parser_1.default.text({ limit: "25mb" }));
|
|
39
39
|
// Adicionar parser para tipos não especificados
|
|
40
|
-
expressApplication.use(body_parser_1.default.raw({ limit: "
|
|
40
|
+
expressApplication.use(body_parser_1.default.raw({ limit: "25mb", type: "*/*" }));
|
|
41
41
|
// Error handler para capturar erros do body-parser (caso o content-length não esteja disponível)
|
|
42
42
|
expressApplication.use((error, request, response, next) => {
|
|
43
43
|
if (error && (error.status === 413 || error.type === "entity.too.large" || error.message?.includes("request entity too large"))) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2-http",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.172",
|
|
4
4
|
"description": "Biblioteca Typescript para API NodeJS",
|
|
5
5
|
"repository": "https://cabralsilva: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@github.com/cabralsilva/c2-http.git",
|
|
6
6
|
"author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",
|