Socket
Socket
Sign inDemoInstall

serve-handler

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serve-handler - npm Package Compare versions

Comparing version 3.4.0 to 3.5.0

2

package.json
{
"name": "serve-handler",
"version": "3.4.0",
"version": "3.5.0",
"description": "The routing foundation of `serve` and static deployments on Now",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -259,3 +259,3 @@ # serve-handler

If you want to replace the methods the package is using for interacting with the file system, you can pass them as the fourth argument to the function call.
If you want to replace the methods the package is using for interacting with the file system and sending responses, you can pass them as the fourth argument to the function call.

@@ -268,3 +268,4 @@ These are the methods used by the package (they can all return a `Promise` or be asynchronous):

createReadStream(path) {},
readdir(path) {}
readdir(path) {},
sendError(absolutePath, response, acceptsJSON, root, handlers, config, error) {}
});

@@ -271,0 +272,0 @@ ```

@@ -20,8 +20,2 @@ // Native

const getHandlers = methods => Object.assign({
stat: promisify(stat),
createReadStream: createReadStream,
readdir: promisify(readdir)
}, methods);
const sourceMatches = (source, requestPath, allowSegments) => {

@@ -497,2 +491,9 @@ const keys = [];

const getHandlers = methods => Object.assign({
stat: promisify(stat),
createReadStream,
readdir: promisify(readdir),
sendError
}, methods);
module.exports = async (request, response, config = {}, methods = {}) => {

@@ -633,3 +634,4 @@ const cwd = process.cwd();

if (!stats) {
return sendError(absolutePath, response, acceptsJSON, current, handlers, config, {
// allow for custom 404 handling
return handlers.sendError(absolutePath, response, acceptsJSON, current, handlers, config, {
statusCode: 404,

@@ -636,0 +638,0 @@ code: 'not_found',

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