ultimate-express 1.0.7 → 1.0.8
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/package.json +1 -1
- package/src/response.js +12 -10
package/README.md
CHANGED
|
@@ -229,7 +229,7 @@ In general, basically all features and options are supported. Use [Express 4.x d
|
|
|
229
229
|
- - ✅ Range header
|
|
230
230
|
- - ✅ Setting ETag header
|
|
231
231
|
- - ✅ If-Match header
|
|
232
|
-
- - ✅ If-Modified-Since header
|
|
232
|
+
- - ✅ If-Modified-Since header (with `options.ifModifiedSince` option)
|
|
233
233
|
- - ✅ If-Unmodified-Since header
|
|
234
234
|
- - ✅ If-Range header
|
|
235
235
|
- ✅ res.sendStatus()
|
package/package.json
CHANGED
package/src/response.js
CHANGED
|
@@ -333,16 +333,18 @@ module.exports = class Response extends Writable {
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
// if-modified-since
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
336
|
+
if(options.ifModifiedSince) {
|
|
337
|
+
let modifiedSince = this.req.headers['if-modified-since'];
|
|
338
|
+
let lastModified = this.headers['last-modified'];
|
|
339
|
+
if(options.lastModified && lastModified && modifiedSince) {
|
|
340
|
+
modifiedSince = parseHttpDate(modifiedSince);
|
|
341
|
+
lastModified = parseHttpDate(lastModified);
|
|
342
|
+
|
|
343
|
+
if(!isNaN(lastModified) && !isNaN(modifiedSince) && lastModified <= modifiedSince) {
|
|
344
|
+
this.status(304);
|
|
345
|
+
return this.end();
|
|
346
|
+
};
|
|
347
|
+
}
|
|
346
348
|
}
|
|
347
349
|
|
|
348
350
|
// range requests
|