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

egg-controller

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-controller - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

14

config/config.default.d.ts
declare const _default: {
controller: {
/** auto load controller in 'ctrlDir', only require file, can't load to ctx */
autoLoad: boolean;
/** controllers dir path,support array */
ctrlDir: string | string[];
/** generate frontend request sdk */
genSDK: {
enable: boolean;
/** generate code type, support ts/js */
type: "ts" | "js";
/** generate code dir path */
SDKDir: string;
/** generate template */
templatePath: string;
/** route filter for generate */
filter: RegExp[];
};
compatible: {
/**
* return 404 when controller didn't change ctx.body (egg default)
* if 'false', will return 204
*/
ret404WhenNoChangeBody: boolean;
};
};

@@ -13,0 +27,0 @@ aop: {

@@ -6,11 +6,25 @@ "use strict";

controller: {
/** auto load controller in 'ctrlDir', only require file, can't load to ctx */
autoLoad: true,
/** controllers dir path,support array */
ctrlDir: path.join('app', 'controller'),
/** generate frontend request sdk */
genSDK: {
enable: false,
/** generate code type, support ts/js */
type: 'ts',
/** generate code dir path */
SDKDir: path.join('app', 'assets', 'service'),
/** generate template */
templatePath: '',
/** route filter for generate */
filter: [/^\/api\//g],
},
compatible: {
/**
* return 404 when controller didn't change ctx.body (egg default)
* if 'false', will return 204
*/
ret404WhenNoChangeBody: false,
}
},

@@ -17,0 +31,0 @@ aop: {

3

lib/route.js

@@ -120,3 +120,4 @@ "use strict";

}
if (ctx.body === undefined && ctx.status === 404) {
const { ret404WhenNoChangeBody } = ctx.app.config.controller.compatible;
if (!ret404WhenNoChangeBody && ctx.body === undefined && ctx.status === 404) {
ctx.status = 204;

@@ -123,0 +124,0 @@ }

{
"name": "egg-controller",
"version": "0.2.2",
"version": "0.2.3",
"description": "controller for egg.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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