Socket
Socket
Sign inDemoInstall

aldo-http

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aldo-http - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

index.d.ts

@@ -511,2 +511,4 @@

proxy?: boolean
[x: string]: any
}

@@ -513,0 +515,0 @@

31

lib/server.js

@@ -6,12 +6,12 @@ "use strict";

const timers_1 = require("timers");
class Server {
class default_1 {
/**
* Initialize a Server instance
*
* @param native HTTP(S) server instance
* @param server HTTP(S) server instance
* @param options
*/
constructor(native, options = {}) {
this.native = native;
constructor(server, options = {}) {
this._options = options;
this.native = server;
}

@@ -25,5 +25,3 @@ /**

on(event, fn) {
if (event === 'request')
fn = this._wrap(fn);
this.native.on(event, fn);
this.native.on(event, this._wrap(event, fn));
return this;

@@ -57,12 +55,19 @@ }

*
* @param fn event listener
* @param event
* @param fn listener
* @private
*/
_wrap(fn) {
_wrap(event, fn) {
var opts = this._options;
return (req, res) => {
timers_1.setImmediate(fn, new request_1.default(req, opts), new response_1.default(res, opts));
};
switch (event) {
case 'request':
case 'checkContinue':
case 'checkExpectation':
return (req, res) => {
timers_1.setImmediate(fn, new request_1.default(req, opts), new response_1.default(res, opts));
};
}
return () => { timers_1.setImmediate(fn, ...arguments); };
}
}
exports.default = Server;
exports.default = default_1;
{
"name": "aldo-http",
"version": "0.2.1",
"version": "0.2.2",
"description": "Enhanced HTTP createServer module for Node.js",

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

@@ -28,3 +28,3 @@

### HTTP server
### HTTP
```js

@@ -56,3 +56,3 @@ const { createServer } = require('aldo-http')

### HTTPS server
### HTTPS
```js

@@ -85,2 +85,3 @@ const { readFileSync } = require('fs')

```
### Trust proxy

@@ -159,2 +160,4 @@ To enable parsing `X-Forwarded-*` request headers, the `proxy` flag can be set to `true`

readonly writable: boolean;
readonly headersSent: boolean;
readonly headers: http.OutgoingHttpHeaders;

@@ -161,0 +164,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