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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-express",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "The Ultimate Express. Fastest http server with full Express compatibility, based on uWebSockets.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
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
- let modifiedSince = this.req.headers['if-modified-since'];
337
- let lastModified = this.headers['last-modified'];
338
- if(options.lastModified && lastModified && modifiedSince) {
339
- modifiedSince = parseHttpDate(modifiedSince);
340
- lastModified = parseHttpDate(lastModified);
341
-
342
- if(!isNaN(lastModified) && !isNaN(modifiedSince) && lastModified <= modifiedSince) {
343
- this.status(304);
344
- return this.end();
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