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
736
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.18-alpha-20221220105110-a226647 to 0.4.18-alpha-20221220120052-cd1457c

6

index.d.ts

@@ -12,7 +12,7 @@ /// <reference types="node" />

}
export interface ServerAdapterObject<TServerContext> extends EventListenerObject {
export interface ServerAdapterObject<TServerContext, TBaseObject extends ServerAdapterBaseObject<TServerContext, ServerAdapterRequestHandler<TServerContext>>> extends EventListenerObject {
/**
* A basic request listener that takes a `Request` with the server context and returns a `Response`.
*/
handleRequest: (request: Request, ctx: TServerContext) => Promise<Response> | Response;
handleRequest: TBaseObject['handle'];
/**

@@ -46,3 +46,3 @@ * WHATWG Fetch spec compliant `fetch` function that can be used for testing purposes.

}
export type ServerAdapter<TServerContext, TBaseObject extends ServerAdapterBaseObject<TServerContext>> = TBaseObject & ServerAdapterObject<TServerContext>['handle'] & ServerAdapterObject<TServerContext>;
export type ServerAdapter<TServerContext, TBaseObject extends ServerAdapterBaseObject<TServerContext>> = TBaseObject & ServerAdapterObject<TServerContext, TBaseObject>['handle'] & ServerAdapterObject<TServerContext, TBaseObject>;
export type ServerAdapterRequestHandler<TServerContext> = (request: Request, ctx: TServerContext) => Promise<Response> | Response;

@@ -49,0 +49,0 @@ export type DefaultServerAdapterContext = {

@@ -194,14 +194,3 @@ 'use strict';

RequestCtor = fetch.Request) {
const providedRequestHandler = typeof serverAdapterBaseObject === 'function' ? serverAdapterBaseObject : serverAdapterBaseObject.handle;
async function handleRequest(request, ctx) {
try {
return await providedRequestHandler(request, ctx);
}
catch (e) {
return new Response(e.stack || e.message || e.toString(), {
status: e.statusCode || e.status || 500,
statusText: e.statusText || 'Internal Server Error',
});
}
}
const handleRequest = typeof serverAdapterBaseObject === 'function' ? serverAdapterBaseObject : serverAdapterBaseObject.handle;
function handleNodeRequest(nodeRequest, ...ctx) {

@@ -208,0 +197,0 @@ const serverContext = ctx.length > 1 ? Object.assign({}, ...ctx) : ctx[0];

{
"name": "@whatwg-node/server",
"version": "0.4.18-alpha-20221220105110-a226647",
"version": "0.4.18-alpha-20221220120052-cd1457c",
"description": "Fetch API compliant HTTP Server adapter",

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

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