minimalistic-server 0.0.49 → 0.0.50
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.
- package/index.mjs +8 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -729,6 +729,7 @@ const mimeTypes = {
|
|
|
729
729
|
"zip": "application/zip",
|
|
730
730
|
"zir": "application/vnd.zul",
|
|
731
731
|
"zmm": "application/vnd.handheld-entertainment+xml",
|
|
732
|
+
__proto__: null,
|
|
732
733
|
};
|
|
733
734
|
|
|
734
735
|
export function getServerFsPromiseModule() {
|
|
@@ -805,13 +806,13 @@ export class Request {
|
|
|
805
806
|
this.#method = request.method.toUpperCase();
|
|
806
807
|
|
|
807
808
|
for (const k in request.headers) {
|
|
808
|
-
this.#headers
|
|
809
|
+
Object.defineProperty(this.#headers, k.toLowerCase(), { value: request.headers[k] });
|
|
809
810
|
}
|
|
810
811
|
|
|
811
812
|
this.#path = url.pathname.split('/').filter(x => x).join('/');
|
|
812
813
|
|
|
813
814
|
url.searchParams.forEach((v, k) => {
|
|
814
|
-
this.#queryParams
|
|
815
|
+
Object.defineProperty(this.#queryParams, k, { value: v });
|
|
815
816
|
});
|
|
816
817
|
}
|
|
817
818
|
|
|
@@ -989,7 +990,7 @@ export class Request {
|
|
|
989
990
|
parent[index] = nextParent;
|
|
990
991
|
}
|
|
991
992
|
} else if (!(parent instanceof Array) && !curFragment.match(/^-?\d+$/gm)) {
|
|
992
|
-
parent
|
|
993
|
+
Object.defineProperty(parent, curFragment, { value: nextFragment });
|
|
993
994
|
} else {
|
|
994
995
|
break;
|
|
995
996
|
}
|
|
@@ -1091,7 +1092,7 @@ export class Request {
|
|
|
1091
1092
|
}
|
|
1092
1093
|
|
|
1093
1094
|
if (name in data && !Array.isArray(data[name])) {
|
|
1094
|
-
data
|
|
1095
|
+
Object.defineProperty(data, name, { value: [data[name]] });
|
|
1095
1096
|
}
|
|
1096
1097
|
|
|
1097
1098
|
if (Array.isArray(data[name])) {
|
|
@@ -1100,7 +1101,7 @@ export class Request {
|
|
|
1100
1101
|
}
|
|
1101
1102
|
|
|
1102
1103
|
} else {
|
|
1103
|
-
data
|
|
1104
|
+
Object.defineProperty(data, name, { value });
|
|
1104
1105
|
}
|
|
1105
1106
|
}
|
|
1106
1107
|
|
|
@@ -2239,7 +2240,7 @@ function normalizeRoutes(routes, handleServerError) {
|
|
|
2239
2240
|
|
|
2240
2241
|
for (const fragment of split) {
|
|
2241
2242
|
if (!parent[fragment]) {
|
|
2242
|
-
parent[fragment] = {};
|
|
2243
|
+
parent[fragment] = { __proto__: null };
|
|
2243
2244
|
}
|
|
2244
2245
|
|
|
2245
2246
|
parent = parent[fragment];
|
|
@@ -2367,7 +2368,7 @@ async function handleRequest(req, routes, staticFileDirectories, handleNotFoundE
|
|
|
2367
2368
|
if (!newRouteHandler) {
|
|
2368
2369
|
for (let k in routeHandler) {
|
|
2369
2370
|
if (k.match(/^{\w+}$/gm)) {
|
|
2370
|
-
pathParams
|
|
2371
|
+
Object.defineProperty(pathParams, k.replace(/[{}]/gm, ''), { value: decodeURIComponent(fragment) });
|
|
2371
2372
|
newRouteHandler = routeHandler[k];
|
|
2372
2373
|
break;
|
|
2373
2374
|
}
|