Socket
Socket
Sign inDemoInstall

serve-handler

Package Overview
Dependencies
17
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.15 to 2.3.16

4

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

@@ -65,3 +65,3 @@ "main": "src/index.js",

"glob-slasher": "1.0.1",
"mime": "2.3.1",
"mime-types": "2.1.18",
"minimatch": "3.0.4",

@@ -68,0 +68,0 @@ "path-is-inside": "1.0.2",

@@ -11,3 +11,3 @@ // Native

const pathToRegExp = require('path-to-regexp');
const mime = require('mime/lite');
const mime = require('mime-types');
const bytes = require('bytes');

@@ -192,3 +192,2 @@ const isPathInside = require('path-is-inside');

const defaultHeaders = {
'Content-Type': mime.getType(relativePath) || mime.getType(rewrittenPath),
'Last-Modified': stats.mtime.toUTCString(),

@@ -198,2 +197,9 @@ 'Content-Length': stats.size

const getBase = target => (target ? path.parse(target).base : '');
const contentType = mime.contentType(getBase(relativePath)) || mime.contentType(getBase(rewrittenPath));
if (contentType) {
defaultHeaders['Content-Type'] = contentType;
}
return Object.assign(defaultHeaders, related);

@@ -247,3 +253,4 @@ };

stats,
absolutePath
absolutePath,
rewrittenPath: related
};

@@ -439,3 +446,3 @@ }

const rewrittenPath = applyRewrites(relativePath, config.rewrites);
let rewrittenPath = applyRewrites(relativePath, config.rewrites);

@@ -447,3 +454,3 @@ if ((!stats || stats.isDirectory()) && (cleanUrl || rewrittenPath)) {

if (related) {
({stats, absolutePath} = related);
({stats, absolutePath, rewrittenPath} = related);
}

@@ -467,3 +474,3 @@ } catch (err) {

if (((stats && stats.isDirectory()) || !stats) && acceptsJSON) {
response.setHeader('Content-Type', 'application/json');
response.setHeader('Content-Type', 'application/json; charset=utf-8');
}

@@ -470,0 +477,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc