Socket
Socket
Sign inDemoInstall

assert-path-segments

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    assert-path-segments

HTTP middleware that validates that no empty path segments (//) are present


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

assert-path-segments Build Status

HTTP middleware that validates that no empty path segments (//) are present

Install

$ npm install --save assert-path-segments

Usage

var assertPathSegments = require('assert-path-segments')

server.on('request', function (req, res) {
  assertPathSegments(req, res, function (err) {
    if (!err) return res.end('ok!')
    res.end(err.message)
  })
})

API

assertPathSegments(req, res, callback) -> undefined
req

Required
Type: object

An HTTP request object.

res

Required
Type: object

An HTTP response object.

callback

Required
Type: function
Arguments: err

A callback that will be called with an error if the path contains empty segments. If the path is valid, the callback will be called with no arguments.

License

MIT © Ben Drucker

Keywords

FAQs

Last updated on 03 Feb 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc