@wooksjs/http-static 0.2.3 → 0.2.5
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/README.md +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**!!! This is work-in-progress library, breaking changes are expected !!!**
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<img src="../../wooks-logo.png"
|
|
6
|
+
<img src="../../wooks-logo.png" width="450px"><br>
|
|
7
7
|
<a href="https://github.com/wooksjs/wooksjs/blob/main/LICENSE">
|
|
8
8
|
<img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" />
|
|
9
9
|
</a>
|
package/dist/index.cjs
CHANGED
|
@@ -1243,7 +1243,7 @@ function serveFile(filePath, options = {}) {
|
|
|
1243
1243
|
return serveFile(filePath + '.' + options.defaultExt);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
|
-
throw new eventHttp.
|
|
1246
|
+
throw new eventHttp.HttpError(404);
|
|
1247
1247
|
}
|
|
1248
1248
|
status(200);
|
|
1249
1249
|
// if-none-match & if-modified-since processing start
|
|
@@ -1280,7 +1280,7 @@ function serveFile(filePath, options = {}) {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
removeHeader('etag');
|
|
1282
1282
|
removeHeader('last-modified');
|
|
1283
|
-
throw new eventHttp.
|
|
1283
|
+
throw new eventHttp.HttpError(404);
|
|
1284
1284
|
}
|
|
1285
1285
|
// range header processing start
|
|
1286
1286
|
let range = headers.range;
|
|
@@ -1293,7 +1293,7 @@ function serveFile(filePath, options = {}) {
|
|
|
1293
1293
|
end = e ? parseInt(e) : (size - 1);
|
|
1294
1294
|
end = Math.min(size - 1, end);
|
|
1295
1295
|
if (start > end || isNaN(start) || isNaN(end)) {
|
|
1296
|
-
throw new eventHttp.
|
|
1296
|
+
throw new eventHttp.HttpError(416);
|
|
1297
1297
|
}
|
|
1298
1298
|
size = (end - start) + 1;
|
|
1299
1299
|
// if-range processing start
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useHttpContext, useResponse, useSetHeaders, useHeaders, useRequest, useSetCacheControl,
|
|
1
|
+
import { useHttpContext, useResponse, useSetHeaders, useHeaders, useRequest, useSetCacheControl, HttpError, BaseWooksResponse } from '@wooksjs/event-http';
|
|
2
2
|
import { createReadStream, promises } from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
@@ -1241,7 +1241,7 @@ function serveFile(filePath, options = {}) {
|
|
|
1241
1241
|
return serveFile(filePath + '.' + options.defaultExt);
|
|
1242
1242
|
}
|
|
1243
1243
|
}
|
|
1244
|
-
throw new
|
|
1244
|
+
throw new HttpError(404);
|
|
1245
1245
|
}
|
|
1246
1246
|
status(200);
|
|
1247
1247
|
// if-none-match & if-modified-since processing start
|
|
@@ -1278,7 +1278,7 @@ function serveFile(filePath, options = {}) {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
removeHeader('etag');
|
|
1280
1280
|
removeHeader('last-modified');
|
|
1281
|
-
throw new
|
|
1281
|
+
throw new HttpError(404);
|
|
1282
1282
|
}
|
|
1283
1283
|
// range header processing start
|
|
1284
1284
|
let range = headers.range;
|
|
@@ -1291,7 +1291,7 @@ function serveFile(filePath, options = {}) {
|
|
|
1291
1291
|
end = e ? parseInt(e) : (size - 1);
|
|
1292
1292
|
end = Math.min(size - 1, end);
|
|
1293
1293
|
if (start > end || isNaN(start) || isNaN(end)) {
|
|
1294
|
-
throw new
|
|
1294
|
+
throw new HttpError(416);
|
|
1295
1295
|
}
|
|
1296
1296
|
size = (end - start) + 1;
|
|
1297
1297
|
// if-range processing start
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/http-static",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
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.5"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/http-static#readme"
|
|
37
37
|
}
|