New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ceicc/range

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ceicc/range - npm Package Compare versions

Comparing version 3.0.0-beta.1 to 3.0.0-beta.2

29

index.js

@@ -54,2 +54,8 @@ const

* @property {boolean} [hushErrors] Whether to ignore errors and reply with status code `500`, or pass the error to `next` function - default: `false`
*
* @property {boolean} [trailingSlash] Redirect directory requests to add trailing slash - default `true`
*
* disabling this option will led to relative path issues. [see #9](https://github.com/Ceicc/range/issues/9)
*
* `implicitIndex` must be `true`
*/

@@ -67,3 +73,3 @@

baseDir: { default: '.', type: "string" },
hushErrors: { default: false, type: "boolean" },
hushErrors: { default: false, type: "boolean" },
conditional: { default: true, type: "boolean" },

@@ -76,5 +82,11 @@ range: { default: true, type: "boolean" },

implicitIndex: { default: true, type: "boolean|array" },
trailingSlash: { default: true, type: "boolean" },
})
/**
* @param {IncomingMessage} req request object
* @param {ServerResponse} res response object
* @param {Function} next errors handler function
*/
return async function rangeMiddleware(req, res, next = console.error) {

@@ -128,2 +140,9 @@

if (options.trailingSlash && !hasTrailingSlash(req.pathname)) {
res.statusCode = 301
res.setHeader("Location", req.pathname + "/")
res.end()
return
}
const extensions = new Set()

@@ -301,2 +320,10 @@

return streamIt(path, res, { start, end })
}
/**
* @param {string} url
* @returns {boolean}
*/
function hasTrailingSlash(url) {
return url[url.length - 1] === "/"
}

2

package.json
{
"name": "@ceicc/range",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"description": "http range request handler",

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

@@ -23,3 +23,3 @@ # range

```
This will server every request starts with `/public/` with `range`.
This will serve every request starts with `/public/` with `range`.

@@ -107,3 +107,14 @@ The base directory will be `.` or the current working directory, unless specified in the `options` object.

#### `trailingSlash`
- default: `true`
- type: `boolean`
Redirect directory requests to add trailing slash - default `true`
disabling this option will led to relative path issues. [see #9](https://github.com/Ceicc/range/issues/9)
`implicitIndex` must be `true`
## Real World Example

@@ -110,0 +121,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