1 |
|
2 | function defineConfig(config) {
|
3 | return {
|
4 | allowedMethods: config.allowedMethods || ["POST", "PUT", "PATCH", "DELETE"],
|
5 | form: {
|
6 | encoding: "utf-8",
|
7 | limit: "1mb",
|
8 | queryString: {},
|
9 | types: ["application/x-www-form-urlencoded"],
|
10 | convertEmptyStringsToNull: true,
|
11 | ...config.form
|
12 | },
|
13 | json: {
|
14 | encoding: "utf-8",
|
15 | limit: "1mb",
|
16 | strict: true,
|
17 | types: [
|
18 | "application/json",
|
19 | "application/json-patch+json",
|
20 | "application/vnd.api+json",
|
21 | "application/csp-report"
|
22 | ],
|
23 | convertEmptyStringsToNull: true,
|
24 | ...config.json
|
25 | },
|
26 | raw: {
|
27 | encoding: "utf-8",
|
28 | limit: "1mb",
|
29 | types: ["text/*"],
|
30 | ...config.raw
|
31 | },
|
32 | multipart: {
|
33 | autoProcess: true,
|
34 | processManually: [],
|
35 | encoding: "utf-8",
|
36 | maxFields: 1e3,
|
37 | limit: "20mb",
|
38 | types: ["multipart/form-data"],
|
39 | convertEmptyStringsToNull: true,
|
40 | ...config.multipart
|
41 | }
|
42 | };
|
43 | }
|
44 |
|
45 | export {
|
46 | defineConfig
|
47 | };
|
48 |
|
\ | No newline at end of file |