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 1.2.0 to 1.2.1

21

lib/server/low.js

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

const reqWrapper = new HttpRequest(req)
const resWrapper = new HttpResponse(res)
const resWrapper = new HttpResponse(res, server)

@@ -52,2 +52,17 @@ const method = reqWrapper.method

server.start = (port, cb) => {
server.listen(port, socket => {
server._socket = socket
cb(socket)
})
}
server._date = new Date().toUTCString()
const timer = setInterval(() => (server._date = new Date().toUTCString()), 1000)
server.close = () => {
clearInterval(timer)
uWS.us_listen_socket_close(server._socket)
}
return server

@@ -81,4 +96,5 @@ }

class HttpResponse {
constructor (res) {
constructor (res, server) {
this.res = res
this.server = server

@@ -114,2 +130,3 @@ this.statusCode = 200

this.res.writeStatus(`${this.statusCode} ${this.statusMessage}`)
this.res.writeHeader('Date', this.server._date)

@@ -116,0 +133,0 @@ Object.keys(this.headers).forEach(name => {

2

package.json
{
"name": "0http",
"version": "1.2.0",
"version": "1.2.1",
"description": "Cero friction HTTP request router. The need for speed!",

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

/* global describe, it */
const expect = require('chai').expect
const request = require('supertest')
const uWS = require('uWebSockets.js')

@@ -9,3 +8,2 @@ describe('0http Web Framework - Smoke', () => {

let socket
const { router, server } = require('./index')({

@@ -43,5 +41,4 @@ server: require('./lib/server/low')(),

server.listen(~~process.env.PORT, serverSocket => {
server.start(~~process.env.PORT, serverSocket => {
if (serverSocket) {
socket = serverSocket
done()

@@ -108,4 +105,4 @@ }

it('should successfully terminate the service', async () => {
uWS.us_listen_socket_close(socket)
server.close()
})
})
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