Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

0http

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

0http - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

11

lib/next.js

@@ -12,4 +12,7 @@ function next (middlewares, req, res, index, routerPatterns = {}, defaultRoute, errorHandler) {

function step (err) {
if (err) return errorHandler(err, req, res)
return next(middlewares, req, res, ++index, routerPatterns, defaultRoute, errorHandler)
if (err) {
return errorHandler(err, req, res)
} else {
return next(middlewares, req, res, ++index, routerPatterns, defaultRoute, errorHandler)
}
}

@@ -23,2 +26,4 @@

req.preRouterUrl = req.url
req.preRouterPath = req.path
req.url = req.url.replace(pattern, '')

@@ -31,3 +36,3 @@ }

} catch (err) {
errorHandler(err, req, res)
return errorHandler(err, req, res)
}

@@ -34,0 +39,0 @@ }

@@ -62,3 +62,6 @@ const Trouter = require('trouter')

req.url = req.preRouterUrl
req.path = req.preRouterPath
delete req.preRouterUrl
delete req.preRouterPath

@@ -65,0 +68,0 @@ step()

@@ -74,3 +74,3 @@ const uWS = require('uWebSockets.js')

this.req = uRequest
this.url = uRequest.getUrl()
this.url = uRequest.getUrl() + (uRequest.getQuery() ? '?' + uRequest.getQuery() : '')
this.method = uRequest.getMethod().toUpperCase()

@@ -83,4 +83,2 @@ this.body = null

})
this.query = uRequest.getQuery()
}

@@ -87,0 +85,0 @@

{
"name": "0http",
"version": "2.2.1",
"version": "2.2.2",
"description": "Cero friction HTTP request router. The need for speed!",

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

@@ -18,12 +18,4 @@ /* global describe, it */

})
const router2 = require('../lib/router/sequential')()
router2.get('/url', (req, res, next) => {
req.body = req.url
next()
})
router.use('/r2', router2)
router.use('/r1', router1)
router.use('/*', (req, res, next) => {
router.use('/r1', (req, res, next) => {
res.end(req.url + ':' + req.body)

@@ -34,2 +26,9 @@

const router2 = require('../lib/router/sequential')()
router2.get('/url/:age', (req, res, next) => {
req.params.age = ~~req.params.age
res.end(JSON.stringify(req.params))
})
router.use('/r2/:name', router2)
server.listen(~~process.env.PORT, err => {

@@ -49,3 +48,3 @@ if (!err) done()

it('should hit GET /url on nested routers', async () => {
it('should hit GET /url on nested router /r1', async () => {
await request(baseUrl)

@@ -57,8 +56,13 @@ .get('/r1/url')

})
})
it('should hit GET /url/:age on nested router /r2/:name', async () => {
await request(baseUrl)
.get('/r2/url?var=value')
.get('/r2/rolando/url/33?var=value')
.expect(200)
.then((response) => {
expect(response.text).to.equal('/r2/url?var=value:/url?var=value')
expect(JSON.parse(response.text)).to.deep.include({
name: 'rolando',
age: 33
})
})

@@ -65,0 +69,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