Socket
Socket
Sign inDemoInstall

ecstatic

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecstatic - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

2

lib/ecstatic.js

@@ -140,3 +140,3 @@ #! /usr/bin/env node

res.setHeader('last-modified', (new Date(stat.mtime)).toUTCString());
res.setHeader('cache-control', 'max-age='+cache);
res.setHeader('cache-control', cache);

@@ -143,0 +143,0 @@ // Return a 304 if necessary

@@ -7,2 +7,3 @@ // This is so you can have options aliasing and defaults in one place.

showDir = false,
cache = 'max-age=3600',
defaultExt;

@@ -40,6 +41,14 @@

}
if (opts.cache !== undefined) {
if (typeof opts.cache === 'string') {
cache = opts.cache
} else if(typeof opts.cache === 'number') {
cache = 'max-age=' + opts.cache;
}
}
}
return {
cache: (opts && opts.cache) || 3600,
cache: cache,
autoIndex: autoIndex,

@@ -46,0 +55,0 @@ showDir: showDir,

@@ -40,3 +40,3 @@ var ecstatic = require('../ecstatic'),

res.setHeader('last-modified', (new Date(stat.mtime)).toUTCString());
res.setHeader('cache-control', 'max-age='+cache);
res.setHeader('cache-control', cache);

@@ -43,0 +43,0 @@ sortByIsDirectory(files, function (errs, dirs, files) {

@@ -5,3 +5,3 @@ {

"description": "A simple static file server middleware that works with both Express and Flatiron",
"version": "0.4.1",
"version": "0.4.2",
"homepage": "https://github.com/jesusabdullah/node-ecstatic",

@@ -8,0 +8,0 @@ "repository": {

@@ -92,4 +92,4 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jesusabdullah/node-ecstatic.png)](http://travis-ci.org/jesusabdullah/node-ecstatic)

Customize cache control with `opts.cache`, in seconds. Time defaults to 3600 s
(ie, 1 hour).
Customize cache control with `opts.cache` , if it is a number then it will set max-age in seconds.
Other wise it will pass through directly to cache-control. Time defaults to 3600 s (ie, 1 hour).

@@ -96,0 +96,0 @@ ### `opts.showDir`

@@ -83,3 +83,4 @@ var test = require('tap').test,

autoIndex: true,
showDir: true
showDir: true,
cache: "no-cache"
}));

@@ -103,2 +104,6 @@

t.equal(res.statusCode, r.code, 'status code for `' + file + '`');
if (r.code === 200) {
t.equal(res.headers['cache-control'], 'no-cache', 'cache control for `' + file + '`');
};

@@ -105,0 +110,0 @@ if (r.type !== undefined) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc