@whatwg-node/server
Advanced tools
Comparing version 0.4.6-alpha-20220922124249-c941ae6 to 0.4.6-alpha-20220922203506-26c69f1
/// <reference types="node" /> | ||
/// <reference lib="webworker" /> | ||
import type { IncomingMessage, ServerResponse } from 'node:http'; | ||
import type { RequestListener, ServerResponse } from 'node:http'; | ||
import { NodeRequest } from './utils'; | ||
@@ -37,4 +37,3 @@ export interface ServerAdapterBaseObject<TServerContext, THandleRequest extends ServerAdapterRequestHandler<TServerContext> = ServerAdapterRequestHandler<TServerContext>> { | ||
*/ | ||
requestListener(req: IncomingMessage, res: ServerResponse, ctx: TServerContext): void; | ||
requestListener(req: IncomingMessage, res: ServerResponse, ...ctx: Partial<TServerContext>[]): void; | ||
requestListener: RequestListener; | ||
/** | ||
@@ -41,0 +40,0 @@ * Proxy to requestListener to mimic Node middlewares |
@@ -194,10 +194,5 @@ 'use strict'; | ||
} | ||
async function requestListener(nodeRequest, serverResponse, ...ctx) { | ||
async function requestListener(nodeRequest, serverResponse) { | ||
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, | ||
@@ -281,3 +276,3 @@ res: serverResponse, | ||
if (isReadable(input) && isServerResponse(initOrCtxOrRes)) { | ||
return requestListener(input, initOrCtxOrRes, ...ctx); | ||
return requestListener(input, initOrCtxOrRes); | ||
} | ||
@@ -284,0 +279,0 @@ if (isServerResponse(initOrCtxOrRes)) { |
{ | ||
"name": "@whatwg-node/server", | ||
"version": "0.4.6-alpha-20220922124249-c941ae6", | ||
"version": "0.4.6-alpha-20220922203506-26c69f1", | ||
"description": "Fetch API compliant HTTP Server adapter", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
41705
752