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.8 to 0.4.9

test/core-handleError.js

5

lib/ecstatic.js

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

baseDir = opts.baseDir,
defaultExt = opts.defaultExt;
defaultExt = opts.defaultExt,
handleError = opts.handleError;

@@ -93,3 +94,3 @@ opts.root = dir;

middleware({
url: '/' + path.join(baseDir, '404.html'),
url: (handleError ? ('/' + path.join(baseDir, '404.html')) : req.url),
statusCode: 404 // Override the response status code

@@ -96,0 +97,0 @@ }, res, next);

16

lib/ecstatic/opts.js

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

gzip = false,
defaultExt;
defaultExt,
handleError = true;

@@ -55,2 +56,12 @@ if (opts) {

}
[
'handleError',
'handleerror'
].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
handleError = opts[k];
return true;
}
});
}

@@ -64,4 +75,5 @@

baseDir: (opts && opts.baseDir) || '/',
gzip: gzip
gzip: gzip,
handleError: handleError
}
}

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

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

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

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

### `opts.handleError`
Turn **off** handleErrors to allow fall-through with `opts.handleError === false`, Defaults to **true**.
## middleware(req, res, next);

@@ -120,0 +124,0 @@

@@ -56,7 +56,14 @@ var test = require('tap').test,

type : 'text/html',
body : 'index!!!\n',
body : 'index!!!\n'
},
'404' : {
code : 404
code : 200,
type : 'text/html',
body : '<h1>404</h1>\n'
},
'something-non-existant' : {
code : 200,
type : 'text/html',
body : '<h1>404</h1>\n'
},
'compress/foo.js' : {

@@ -96,3 +103,4 @@ code : 200,

autoIndex: true,
showDir: true
showDir: true,
handleError: true
})

@@ -99,0 +107,0 @@ );

@@ -55,4 +55,11 @@ var test = require('tap').test,

'404' : {
code : 404
code : 200,
type : 'text/html',
body : '<h1>404</h1>\n'
},
'something-non-existant' : {
code : 200,
type : 'text/html',
body : '<h1>404</h1>\n'
},
'compress/foo.js' : {

@@ -85,3 +92,4 @@ code : 200,

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

@@ -88,0 +96,0 @@

@@ -54,4 +54,11 @@ var test = require('tap').test,

'404' : {
code : 404
code : 200,
type: 'text/html',
body: '<h1>404</h1>\n'
},
'something-non-existant' : {
code : 200,
type: 'text/html',
body: '<h1>404</h1>\n'
},
'compress/foo.js' : {

@@ -83,3 +90,4 @@ code : 200,

autoIndex: true,
showDir: true
showDir: true,
handleError: true
})

@@ -86,0 +94,0 @@ ]

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