@wooksjs/http-static 0.2.7 → 0.2.9
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/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1273,7 +1273,7 @@ function serveFile(filePath, options = {}) {
|
|
|
1273
1273
|
}
|
|
1274
1274
|
else if (options.index) {
|
|
1275
1275
|
if (filePath[filePath.length - 1] !== '/' && url && url[url.length - 1] !== '/') {
|
|
1276
|
-
return new eventHttp.
|
|
1276
|
+
return new eventHttp.BaseHttpResponse().setStatus(302).setHeader('location', url + '/');
|
|
1277
1277
|
}
|
|
1278
1278
|
restoreCtx();
|
|
1279
1279
|
return serveFile(path.join(filePath, options.index), Object.assign(Object.assign({}, options), { index: '' }));
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useHttpContext, useResponse, useSetHeaders, useHeaders, useRequest, useSetCacheControl, HttpError,
|
|
1
|
+
import { useHttpContext, useResponse, useSetHeaders, useHeaders, useRequest, useSetCacheControl, HttpError, BaseHttpResponse } from '@wooksjs/event-http';
|
|
2
2
|
import { createReadStream, promises } from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
@@ -1271,7 +1271,7 @@ function serveFile(filePath, options = {}) {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
else if (options.index) {
|
|
1273
1273
|
if (filePath[filePath.length - 1] !== '/' && url && url[url.length - 1] !== '/') {
|
|
1274
|
-
return new
|
|
1274
|
+
return new BaseHttpResponse().setStatus(302).setHeader('location', url + '/');
|
|
1275
1275
|
}
|
|
1276
1276
|
restoreCtx();
|
|
1277
1277
|
return serveFile(path.join(filePath, options.index), Object.assign(Object.assign({}, options), { index: '' }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/http-static",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "@wooksjs/http-static",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"url": "https://github.com/wooksjs/wooksjs/issues"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@wooksjs/event-http": "0.2.
|
|
34
|
+
"@wooksjs/event-http": "0.2.9"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/http-static#readme"
|
|
37
37
|
}
|