Socket
Socket
Sign inDemoInstall

rjweb-server

Package Overview
Dependencies
75
Maintainers
1
Versions
367
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.0.2 to 9.0.3

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 9.0.3
- Properly handle global context
## 9.0.2

@@ -2,0 +6,0 @@

3

lib/cjs/classes/Server.js

@@ -75,2 +75,3 @@ "use strict";

*/ constructor(implementation, options, middlewares, context = {}) {
this.context = context;
this._status = 'stopped';

@@ -232,3 +233,3 @@ this.promises = [];

this.implementation.handle({
http: (context) => (0, http_1.default)(new RequestContext_1.default(context, this.middlewares, this, this.global), context, this, this.middlewares),
http: (context) => (0, http_1.default)(new RequestContext_1.default(context, this.middlewares, this, this.global), context, this, this.middlewares, this.context),
ws: (ws) => (0, ws_1.default)(ws.data(), ws, this, this.middlewares)

@@ -235,0 +236,0 @@ });

@@ -15,3 +15,3 @@ "use strict";

* @since 9.0.0
*/ async function handle(context, req, server, middlewares) {
*/ async function handle(context, req, server, middlewares, customContext) {
if (context.global.options.version)

@@ -27,2 +27,3 @@ req.header('rjweb-server', index_1.version);

const ctr = new context.global.classContexts.HttpRequest(context, req, req.aborted());
Object.assign(ctr["@"], customContext);
if (context.global.options.proxy.enabled) {

@@ -29,0 +30,0 @@ context.response.headers.set('proxy-authenticate', `Basic realm="Access rjweb-server@${index_1.version}"`);

{
"name": "rjweb-server",
"version": "9.0.2",
"version": "9.0.3",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

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

@@ -69,2 +69,3 @@ import { ReverseProxyIps } from "../types/global";

*/ constructor(implementation, options, middlewares, context = {}) {
this.context = context;
this._status = 'stopped';

@@ -226,3 +227,3 @@ this.promises = [];

this.implementation.handle({
http: (context) => httpHandler(new RequestContext(context, this.middlewares, this, this.global), context, this, this.middlewares),
http: (context) => httpHandler(new RequestContext(context, this.middlewares, this, this.global), context, this, this.middlewares, this.context),
ws: (ws) => wsHandler(ws.data(), ws, this, this.middlewares)

@@ -229,0 +230,0 @@ });

@@ -10,3 +10,3 @@ import { parseContent, version } from "../index";

* @since 9.0.0
*/ export default async function handle(context, req, server, middlewares) {
*/ export default async function handle(context, req, server, middlewares, customContext) {
if (context.global.options.version)

@@ -22,2 +22,3 @@ req.header('rjweb-server', version);

const ctr = new context.global.classContexts.HttpRequest(context, req, req.aborted());
Object.assign(ctr["@"], customContext);
if (context.global.options.proxy.enabled) {

@@ -24,0 +25,0 @@ context.response.headers.set('proxy-authenticate', `Basic realm="Access rjweb-server@${version}"`);

{
"name": "rjweb-server",
"version": "9.0.2",
"version": "9.0.3",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

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

@@ -15,2 +15,3 @@ import { BaseImplementation } from "../types/implementation";

export default class Server<const Options extends ServerOptions, Middlewares extends UsableMiddleware[] = [], Context extends Record<string, any> = {}> {
private context;
private options;

@@ -17,0 +18,0 @@ private middlewares;

@@ -8,2 +8,2 @@ import RequestContext from "../types/internal/classes/RequestContext";

* @since 9.0.0
*/ export default function handle(context: RequestContext, req: HttpContext, server: Server<any, any, any>, middlewares: UsableMiddleware[]): Promise<boolean | undefined>;
*/ export default function handle(context: RequestContext, req: HttpContext, server: Server<any, any, any>, middlewares: UsableMiddleware[], customContext: Record<string, any>): Promise<boolean | undefined>;
{
"name": "rjweb-server",
"version": "9.0.2",
"version": "9.0.3",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

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

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