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

@whatwg-node/server

Package Overview
Dependencies
Maintainers
1
Versions
713
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@whatwg-node/server - npm Package Compare versions

Comparing version 0.4.6-alpha-20220921172951-5c43d9d to 0.4.6-alpha-20220922124249-c941ae6

5

index.d.ts
/// <reference types="node" />
/// <reference lib="webworker" />
import type { RequestListener, ServerResponse } from 'node:http';
import type { IncomingMessage, ServerResponse } from 'node:http';
import { NodeRequest } from './utils';

@@ -37,3 +37,4 @@ export interface ServerAdapterBaseObject<TServerContext, THandleRequest extends ServerAdapterRequestHandler<TServerContext> = ServerAdapterRequestHandler<TServerContext>> {

*/
requestListener: RequestListener;
requestListener(req: IncomingMessage, res: ServerResponse, ctx: TServerContext): void;
requestListener(req: IncomingMessage, res: ServerResponse, ...ctx: Partial<TServerContext>[]): void;
/**

@@ -40,0 +41,0 @@ * Proxy to requestListener to mimic Node middlewares

9

index.js

@@ -194,5 +194,10 @@ 'use strict';

}
async function requestListener(nodeRequest, serverResponse) {
async function requestListener(nodeRequest, serverResponse, ...ctx) {
const waitUntilPromises = [];
let serverContext = {};
if ((ctx === null || ctx === void 0 ? void 0 : ctx.length) > 0) {
serverContext = Object.assign({}, serverContext, ...ctx);
}
const response = await handleNodeRequest(nodeRequest, {
...serverContext,
req: nodeRequest,

@@ -276,3 +281,3 @@ res: serverResponse,

if (isReadable(input) && isServerResponse(initOrCtxOrRes)) {
return requestListener(input, initOrCtxOrRes);
return requestListener(input, initOrCtxOrRes, ...ctx);
}

@@ -279,0 +284,0 @@ if (isServerResponse(initOrCtxOrRes)) {

{
"name": "@whatwg-node/server",
"version": "0.4.6-alpha-20220921172951-5c43d9d",
"version": "0.4.6-alpha-20220922124249-c941ae6",
"description": "Fetch API compliant HTTP Server adapter",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -120,3 +120,6 @@ # WHATWG Node Generic Server Adapter

handler: async (req, reply) => {
const response = await myServerAdapter.handleNodeRequest(req)
const response = await myServerAdapter.handleNodeRequest(req, {
req,
reply,
})
response.headers.forEach((value, key) => {

@@ -123,0 +126,0 @@ reply.header(key, value)

Sorry, the diff of this file is not supported yet

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