Socket
Socket
Sign inDemoInstall

find-my-way

Package Overview
Dependencies
Maintainers
2
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-my-way - npm Package Compare versions

Comparing version 7.7.0 to 8.0.0

3

index.js

@@ -91,2 +91,3 @@ 'use strict'

this.constrainer = new Constrainer(opts.constraints)
this.useSemicolonDelimiter = opts.useSemicolonDelimiter || false

@@ -573,3 +574,3 @@ this.routes = []

try {
sanitizedUrl = safeDecodeURI(path)
sanitizedUrl = safeDecodeURI(path, this.useSemicolonDelimiter)
path = sanitizedUrl.path

@@ -576,0 +577,0 @@ querystring = sanitizedUrl.querystring

@@ -37,3 +37,3 @@ 'use strict'

function safeDecodeURI (path) {
function safeDecodeURI (path, useSemicolonDelimiter) {
let shouldDecode = false

@@ -65,4 +65,4 @@ let shouldDecodeParam = false

// string with a `;` character (code 59), e.g. `/foo;jsessionid=123456`.
// Thus, we need to split on `;` as well as `?` and `#`.
} else if (charCode === 63 || charCode === 59 || charCode === 35) {
// Thus, we need to split on `;` as well as `?` and `#` if the useSemicolonDelimiter option is enabled.
} else if (charCode === 63 || charCode === 35 || (charCode === 59 && useSemicolonDelimiter)) {
querystring = path.slice(i + 1)

@@ -69,0 +69,0 @@ path = path.slice(0, i)

{
"name": "find-my-way",
"version": "7.7.0",
"version": "8.0.0",
"description": "Crazy fast http radix based router",

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

# find-my-way
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) ![Node CI](https://github.com/delvedor/find-my-way/workflows/Node%20CI/badge.svg) [![NPM downloads](https://img.shields.io/npm/dm/find-my-way.svg?style=flat)](https://www.npmjs.com/package/find-my-way)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![Node CI](https://github.com/delvedor/find-my-way/actions/workflows/node.js.yml/badge.svg)](https://github.com/delvedor/find-my-way/actions/workflows/node.js.yml) [![NPM downloads](https://img.shields.io/npm/dm/find-my-way.svg?style=flat)](https://www.npmjs.com/package/find-my-way)

@@ -159,2 +159,10 @@ A crazy fast HTTP router, internally uses an highly performant [Radix Tree](https://en.wikipedia.org/wiki/Radix_tree) (aka compact [Prefix Tree](https://en.wikipedia.org/wiki/Trie)), supports route params, wildcards, and it's framework independent.

According to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986#section-3.4), find-my-way separates path and query string with `?` character. But earlier versions also used `;` as delimiter character. To support this behaviour, add the `useSemicolonDelimiter` option to `true`:
```js
const router = require('find-my-way')({
useSemicolonDelimiter: true
})
```
You can assign a `buildPrettyMeta` function to sanitize a route's `store` object to use with the `prettyPrint` functions. This function should accept a single object and return an object.

@@ -700,3 +708,3 @@

Add a custom constraint strategy using the addConstraintStrategy method:
Add an async custom constrain strategy when constructing a router:
```js

@@ -725,3 +733,3 @@ const asyncCustomResponseTypeStrategy = {

Add an async custom constrain strategy when constructing a router:
Add a custom constraint strategy using the `addConstraintStrategy` method:
```js

@@ -728,0 +736,0 @@ const customResponseTypeStrategy = {

@@ -31,5 +31,7 @@ 'use strict'

test('handles path and query separated by ;', t => {
test('handles path and query separated by ; with useSemicolonDelimiter enabled', t => {
t.plan(2)
const findMyWay = FindMyWay()
const findMyWay = FindMyWay({
useSemicolonDelimiter: true
})

@@ -43,1 +45,13 @@ findMyWay.on('GET', '/test', (req, res, params, store, query) => {

})
test('handles path and query separated by ? using ; in the path', t => {
t.plan(2)
const findMyWay = FindMyWay()
findMyWay.on('GET', '/test;jsessionid=123456', (req, res, params, store, query) => {
t.same(query, { foo: 'bar' })
t.ok('inside the handler')
})
findMyWay.lookup({ method: 'GET', url: '/test;jsessionid=123456?foo=bar', headers: {} }, null)
})
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