Skip to content

Commit 01ade37

Browse files
Replace koa-bodyparser to koa-body to allow multipart
1 parent 2769ef5 commit 01ade37

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ A framework based on [Koajs2](https://github.com/koajs/koa) with **Decorator**,
5959
- [`kcors`](https://www.npmjs.com/package/kcors) is used to handle cross-domain requests
6060
- [`koa2-ratelimit`](https://github.com/ysocorp/koa2-ratelimit) To limit bruteforce requests
6161
- [`koa-helmet`](https://www.npmjs.com/package/koa-helmet) helps you secure your api
62-
- [`koa-bodyparser`](https://github.com/koajs/bodyparser) to parse request bodies
62+
- [`koa-body`](https://github.com/dlau/koa-body) to parse request bodies
6363
- [`koa-compress`](https://github.com/koajs/compress) to compress the response
6464
- [`koa-i18n`](https://github.com/koa-modules/i18n) for Internationalization (I18n)
6565

@@ -413,7 +413,7 @@ in order to get started quickly, look at [this boilerplate](https://github.com/y
413413
myApp.addMiddlewares([
414414
cors({ credentials: true }),
415415
helmet(),
416-
bodyParser(),
416+
bodyParser({ multipart: true }),
417417
handleError(),
418418
RateLimit.middleware({ interval: { min: 1 }, max: 100 }),
419419
...
@@ -461,7 +461,7 @@ in order to get started quickly, look at [this boilerplate](https://github.com/y
461461
myApp.addMiddlewares([
462462
cors({ credentials: true }),
463463
helmet(),
464-
bodyParser(),
464+
bodyParser({ multipart: true }),
465465
i18n(myApp.app, {
466466
directory: join(__dirname, 'locales'),
467467
locales: ['en', 'fr'],
@@ -511,7 +511,7 @@ in order to get started quickly, look at [this boilerplate](https://github.com/y
511511
super.addMiddlewares([
512512
cors({ credentials: true }),
513513
helmet(),
514-
bodyParser(),
514+
bodyParser({ multipart: true }),
515515
i18n(this.app, {
516516
directory: join(__dirname, 'locales'),
517517
locales: ['en', 'fr'],

dist/middlewares/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ var _koaHelmet = require('koa-helmet');
88

99
var _koaHelmet2 = _interopRequireDefault(_koaHelmet);
1010

11-
var _koaBodyparser = require('koa-bodyparser');
11+
var _koaBody = require('koa-body');
1212

13-
var _koaBodyparser2 = _interopRequireDefault(_koaBodyparser);
13+
var _koaBody2 = _interopRequireDefault(_koaBody);
1414

1515
var _kcors = require('kcors');
1616

@@ -39,7 +39,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
3939
module.exports = {
4040
cors: _kcors2.default,
4141
helmet: _koaHelmet2.default,
42-
bodyParser: _koaBodyparser2.default,
42+
bodyParser: _koaBody2.default,
4343
compress: _koaCompress2.default,
4444
i18n: _koaI18n2.default,
4545
addDefaultBody: _addDefaultBody2.default,

dist/utils/docGenerator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function generateDoc(classRoute, route) {
7171
var options = route.options;
7272

7373
var className = classRoute.constructor.name.replace('Route', '');
74-
var routePathFileName = options.routePath.replace(/:/g, '-'); // to be able to create folder in Windows
74+
var routePathFileName = options.routePath.replace(/:|\?|"|\\|\/|\*|\|<|>/g, '-'); // to be able to create folder in Windows
7575
_fsExtra2.default.mkdirpSync((0, _path.join)(DIR_TMP, _removeLast(routePathFileName)));
7676
var file = (0, _path.join)(DIR_TMP, (routePathFileName || className) + '.js');
7777
_fsExtra2.default.writeFileSync(file, '\n');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"jsonwebtoken": "^8.5.1",
3232
"kcors": "^2.2.2",
3333
"koa": "^2.7.0",
34-
"koa-bodyparser": "^4.2.1",
34+
"koa-body": "^4.1.0",
3535
"koa-compress": "^3.0.0",
3636
"koa-helmet": "^4.2.0",
3737
"koa-i18n": "^2.1.0",

src/middlewares/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import compress from 'koa-compress';
22
import helmet from 'koa-helmet';
3-
import bodyParser from 'koa-bodyparser';
3+
import bodyParser from 'koa-body';
44
import cors from 'kcors';
55
import { RateLimit, Stores as RateLimitStores } from 'koa2-ratelimit';
66
import i18n from 'koa-i18n';

test/_createserver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default async function create(options = {}) {
3030
app.addMiddlewares([
3131
cors({ credentials: true }),
3232
helmet(),
33-
bodyParser(),
33+
bodyParser({ multipart: true }),
3434
i18n(app.koaApp, {
3535
directory: join(__dirname, 'locales'),
3636
locales: ['en', 'fr'],

0 commit comments

Comments
 (0)