You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

openapi-backend

Package Overview
Dependencies
Maintainers
1
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-backend - npm Package Compare versions

Comparing version

to
5.13.0

35

backend.js

@@ -86,2 +86,6 @@ "use strict";

'unauthorizedHandler',
'preRoutingHandler',
'postRoutingHandler',
'postSecurityHandler',
'preOperationHandler',
'postResponseHandler',

@@ -227,2 +231,7 @@ ];

context.request = this.router.parseRequest(req);
// preRoutingHandler
const preRoutingHandler = this.handlers['preRoutingHandler'];
if (preRoutingHandler) {
await preRoutingHandler(context, ...handlerArgs);
}
// match operation (routing)

@@ -233,2 +242,7 @@ try {

catch (err) {
// postRoutingHandler on routing failure
const postRoutingHandler = this.handlers['postRoutingHandler'];
if (postRoutingHandler) {
await postRoutingHandler(context, ...handlerArgs);
}
let handler = this.handlers['404'] || this.handlers['notFound'];

@@ -247,2 +261,7 @@ if (err instanceof Error && err.message.startsWith('405')) {

context.request = this.router.parseRequest(req, context.operation);
// postRoutingHandler on routing success
const postRoutingHandler = this.handlers['postRoutingHandler'];
if (postRoutingHandler) {
await postRoutingHandler(context, ...handlerArgs);
}
// get security requirements for the matched operation

@@ -306,2 +325,7 @@ // global requirements are already included in the router

};
// postSecurityHandler
const postSecurityHandler = this.handlers['postSecurityHandler'];
if (postSecurityHandler) {
await postSecurityHandler(context, ...handlerArgs);
}
// call unauthorizedHandler handler if auth fails

@@ -334,5 +358,10 @@ if (!authorized && securityRequirements.length > 0) {

}
// preOperationHandler – runs just before the operation handler
const preOperationHandler = this.handlers['preOperationHandler'];
if (preOperationHandler) {
await preOperationHandler(context, ...handlerArgs);
}
// get operation handler
const routeHandler = this.handlers[operationId];
if (!routeHandler) {
const operationHandler = this.handlers[operationId];
if (!operationHandler) {
// 501 not implemented

@@ -346,3 +375,3 @@ const notImplementedHandler = this.handlers['501'] || this.handlers['notImplemented'];

// handle route
return routeHandler(context, ...handlerArgs);
return operationHandler(context, ...handlerArgs);
}).bind(this)();

@@ -349,0 +378,0 @@ // post response handler

2

package.json
{
"name": "openapi-backend",
"description": "Build, Validate, Route, Authenticate and Mock using OpenAPI definitions. Framework-agnostic",
"version": "5.12.0",
"version": "5.13.0",
"author": "Viljami Kuosmanen <viljami@viljami.io>",

@@ -6,0 +6,0 @@ "funding": "https://github.com/sponsors/anttiviljami",

Sorry, the diff of this file is not supported yet