HTTP middleware that validates that no empty path segments (//) are present
$ npm install --save assert-path-segments
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)
})
})
Required
Type: object
An HTTP request object.
Required
Type: object
An HTTP response object.
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.
MIT © Ben Drucker