Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ecstatic

Package Overview
Dependencies
Maintainers
2
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 4.1.0 to 4.1.1

3

CHANGELOG.md

@@ -0,1 +1,4 @@

2019/04/20 Version 4.1.1
- Respect handleError for 400 and 500 errors
2019/04/15 Version 4.1.0

@@ -2,0 +5,0 @@ - Add ability to set the host in cli mode

18

lib/ecstatic/show-dir/index.js

@@ -45,7 +45,3 @@ 'use strict';

if (statErr) {
if (handleError) {
status[500](res, next, { error: statErr });
} else {
next();
}
status[500](res, next, { error: statErr, handleError });
return;

@@ -59,7 +55,3 @@ }

if (readErr) {
if (handleError) {
status[500](res, next, { error: readErr });
} else {
next();
}
status[500](res, next, { error: readErr, handleError });
return;

@@ -157,7 +149,3 @@ }

if (err) {
if (handleError) {
status[500](res, next, { error: err });
} else {
next();
}
status[500](res, next, { error: err, handleError });
return;

@@ -164,0 +152,0 @@ }

@@ -57,2 +57,13 @@ 'use strict';

res.statusCode = 500;
if (!opts.handleError && next) {
next(opts.error);
return;
}
if (res.headersSent) {
res.destroy();
return;
}
res.setHeader('content-type', 'text/html');

@@ -80,19 +91,23 @@ const error = String(opts.error.stack || opts.error || 'No specified error');

res.statusCode = 400;
res.setHeader('content-type', 'text/html');
const error = opts && opts.error ? String(opts.error) : 'Malformed request.';
const html = `${[
'<!doctype html>',
'<html>',
' <head>',
' <meta charset="utf-8">',
' <title>400 Bad Request</title>',
' </head>',
' <body>',
' <p>',
` ${he.encode(error)}`,
' </p>',
' </body>',
'</html>',
].join('\n')}\n`;
res.end(html);
if (typeof next === 'function') {
next();
} else {
res.setHeader('content-type', 'text/html');
const error = opts && opts.error ? String(opts.error) : 'Malformed request.';
const html = `${[
'<!doctype html>',
'<html>',
' <head>',
' <meta charset="utf-8">',
' <title>400 Bad Request</title>',
' </head>',
' <body>',
' <p>',
` ${he.encode(error)}`,
' </p>',
' </body>',
'</html>',
].join('\n')}\n`;
res.end(html);
}
};

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

"description": "A simple static file server middleware",
"version": "4.1.0",
"version": "4.1.1",
"homepage": "https://github.com/jfhbrook/node-ecstatic",

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

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