@@ -46,7 +46,7 @@ export class KoaDriver extends BaseDriver {
4646 this . koa . use ( bodyParser ( ) ) ;
4747 if ( this . cors ) {
4848 // eslint-disable-next-line @typescript-eslint/no-var-requires
49- const cors = require ( 'kcors ' ) ;
49+ const cors = require ( '@koa/cors ' ) ;
5050 if ( this . cors === true ) {
5151 this . koa . use ( cors ( ) ) ;
5252 } else {
@@ -121,9 +121,6 @@ export class KoaDriver extends BaseDriver {
121121 . forEach ( param => {
122122 defaultMiddlewares . push ( multer ( param . extraOptions ) . array ( param . name ) ) ;
123123 } ) ;
124-
125- // eslint-disable-next-line @typescript-eslint/unbound-method
126- defaultMiddlewares . push ( this . fixMulterRequestAssignment ) ;
127124 }
128125
129126 // user used middlewares
@@ -353,7 +350,7 @@ export class KoaDriver extends BaseDriver {
353350 }
354351
355352 /**
356- * Dynamically loads koa and required koa-router module.
353+ * Dynamically loads koa module.
357354 */
358355 protected loadKoa ( ) {
359356 if ( require ) {
@@ -370,16 +367,16 @@ export class KoaDriver extends BaseDriver {
370367 }
371368
372369 /**
373- * Dynamically loads koa- router module.
370+ * Dynamically loads @ koa/ router module.
374371 */
375372 private loadRouter ( ) {
376373 if ( require ) {
377374 if ( ! this . router ) {
378375 try {
379- this . router = new ( require ( 'koa- router' ) ) ( ) ;
376+ this . router = new ( require ( '@ koa/ router' ) ) ( ) ;
380377 } catch ( e ) {
381378 throw new Error (
382- 'koa- router package was not found installed. Try to install it: npm install koa- router@next --save'
379+ '@ koa/ router package was not found installed. Try to install it: npm install @ koa/ router --save'
383380 ) ;
384381 }
385382 }
@@ -389,31 +386,13 @@ export class KoaDriver extends BaseDriver {
389386 }
390387
391388 /**
392- * Dynamically loads koa- multer module.
389+ * Dynamically loads @ koa/ multer module.
393390 */
394391 private loadMulter ( ) {
395392 try {
396- return require ( 'koa- multer' ) ;
393+ return require ( '@ koa/ multer' ) ;
397394 } catch ( e ) {
398- throw new Error ( 'koa-multer package was not found installed. Try to install it: npm install koa-multer --save' ) ;
399- }
400- }
401-
402- /**
403- * This middleware fixes a bug on koa-multer implementation.
404- *
405- * This bug should be fixed by koa-multer PR #15: https://github.com/koa-modules/multer/pull/15
406- */
407- private async fixMulterRequestAssignment ( ctx : any , next : Function ) {
408- if ( 'request' in ctx ) {
409- if ( ctx . req . body ) ctx . request . body = ctx . req . body ;
410- if ( ctx . req . file ) ctx . request . file = ctx . req . file ;
411- if ( ctx . req . files ) {
412- ctx . request . files = ctx . req . files ;
413- ctx . files = ctx . req . files ;
414- }
395+ throw new Error ( '@koa/multer package was not found installed. Try to install it: npm install @koa/multer --save' ) ;
415396 }
416-
417- return await next ( ) ;
418397 }
419398}
0 commit comments