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

18h

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

18h - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

12

dist/index.js

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

const filesystem_1 = require("./util/filesystem");
const body_parser_1 = require("./middleware/body-parser");
const koa_bodyparser_1 = __importDefault(require("koa-bodyparser"));
/**

@@ -51,5 +51,11 @@ * Creates a router at the specified port & hostname, sourcing

for (const { internalHandler, method, middleware, accept } of controller) {
const enableTypes = accept || [];
const { pre = [], post = [] } = middleware || {};
const parsingMiddleware = accept
? [body_parser_1.handleParseError, (0, body_parser_1.bodyParser)({ enableTypes: accept })]
const parsingMiddleware = enableTypes.length
? [
(0, koa_bodyparser_1.default)({
enableTypes: accept,
onerror: (_error, context) => context.throw(422),
}),
]
: [];

@@ -56,0 +62,0 @@ const middlewareChain = [

import Koa, { Next } from "koa";
import Router from "koa-router";
import { mapDirectoryToRoutes } from "@/util/filesystem";
import { handleParseError, bodyParser } from "@/middleware/body-parser";
import { ExtendedContext } from "@/@types/http-method";
import { ParsedRouteController } from "@/@types/route-controller";
import bodyParser from "koa-bodyparser";

@@ -41,5 +41,12 @@ interface CreateRouterParams {

for (const { internalHandler, method, middleware, accept } of controller) {
const enableTypes: string[] = accept || [];
const { pre = [], post = [] } = middleware || {};
const parsingMiddleware = accept
? [handleParseError, bodyParser({ enableTypes: accept })]
const parsingMiddleware = enableTypes.length
? [
bodyParser({
enableTypes: accept,
onerror: (_error, context) => context.throw(422),
}),
]
: [];

@@ -46,0 +53,0 @@

{
"name": "18h",
"description": "A Next.js style dynamic API router for Koa-based APIs.",
"version": "2.2.2",
"version": "2.2.3",
"repository": {

@@ -6,0 +6,0 @@ "url": "https://github.com/ridafkih/18h"

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